These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

Help with conditional statements

NH-Matt
Registered: Jun 17 2008
Posts: 13

This will no doubt be easy for someone but I cannot seem to get the scripting right and I am looking for some help. I would like the user to select from a drop-down list (YES or NO) the answer would then populate another field with either (PASS or FAIL). I am new at this and not sure what I am doing wrong. I think the script would look something like this:

if (DropDownList1=YES)
then (TextField=PASS)
elseif (DropDownList1=NO)
then (TextField1=FAIL)
endif

Also can this be a conditional for an entire form? If I have multiple sections that someone could select Yes or No, can I have the calculation preform as a "check and balance"? I don't want the selection to change the form to one answer or another, just upon selection it will run the script and populate the other field accordingly.

Thanks

My Product Information:
LiveCycle Designer, Windows
gkaiseril
Expert
Registered: Feb 23 2006
Posts: 4308
The equality operator in a logical statement is '==' or 'eq' and the '=' is the set operand. One also has to differentiate between a variable name and a string. Strings of character have to be enclosed within quotation marks to differentiate them from a variable name. So one could write in FormCalc:

if (DropDownList1 == 'YES') then
TextField = 'PASS'
elseif (DropDownList1 eq 'NO') then
TextField1 = 'FAIL'
endif

It is possible to write a document level function that when passed a value will return the result of a comparison.

George Kaiser

NH-Matt
Registered: Jun 17 2008
Posts: 13
This is the alert I see:

Script failed (language is FormCalc; context is
xfa[0].form[0].topmostsubform[0].page7[0].DropDownList1[0])
script=
if(DropDownList1 == 'YES')then
TextField1 = 'PASS'
elseif(DropDownList1 == 'NO') then
Textfield1 = 'FAIL'
endif

Error: syntax error near token ''' on line 2, column 22

Not sure what that means