Javascript- Adobe Acrobat- Drop Down, Field, and Autopopulating

Hi, I'm trying to auto populate multiple fields. I have about 10 different system components and each one has a different value depending on the facility type. The facility type is the dropdown and the field shown are for one of the system components out of the ten.

Here's what I tried to enter in Javascript,

if (xfa.event.newText=="CHAPEL")

if (xfa.event.newText=="CHILD CARE CENTER")

I am getting a syntax error saying missing ; before statement. I'm not sure what I'm missing but I'm also not sure where this javascript should be located. I have it under the drop down menu but I'm not sure if it should be an action under actions tab, Format as Custom, or Validate tab.

Any help ould be greatly appreciated!

Tiffany Lafarier

2 Answers

First thing you need to do is rename your fields and subforms. Spaces and puntuation have special meanings In any language. You can't use them in a name. Names should also be compact and meaningful, you might be typing them a few times.

Next, your codes uses the LiveCycle Scripting model, but you mention the Action, Format, and Validate tabs. These are parts of AcroForm Field properties dialog. So you must have an AcroForm. If that's the case then you need to change the code to match the AcroForm Model.

Thom Parker
The source for PDF Scripting Info

The Acrobat JavaScript Reference, Use it Early and Often

The most important JavaScript Development tool in Acrobat
The Console Window (Video tutorial)
The Console Window(article)

Having trouble, Why Doesn't my Script Work

Thom Parker   

Thom Parker   

Please specify a reason: