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

Conditional Statements in Fields

coveredup
Registered: Jan 8 2009
Posts: 6
Answered

I have a form with yes or no check boxes in question fields. Is there a way to set it up so that if the user checks "no" it automatically goes to the next question field; and if they check "yes", it moves to the next spot in that same field that calls for an explanation of the "yes" answer?

Seems like you would need to set up some sort of "conditional statement" within the field, but I do not know how to do this.

Really HAVE to be able to do this.

Anyone???? My product is Acrobat 9 Pro.

Thanks.

My Product Information:
Acrobat Pro 9.0, Windows
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
Yes, there is a way to do this, but it requires scripting.

Assuming that you are using a regular AcroForm, as opposed to a LiveCycle Designer form, add a "Run a JavaScript" action to the MouseUp event for the check box. Enter a script similar to this one:
if(event.target.value == "Yes")this.getField("Explaination").setFocus();elsethis.getField("NextCheck").setFocus();

Of course you will need to change the field names to match those on your form. The "event.target.value" parameter is the value of the check box.

Keyboard focus for check boxes is not always obvious, i.e., you can't always tell when a check box has the focus, so you may want to add some other kind of visual que, like changing the background color.

Thom Parker
The source for PDF Scripting Info
[url=http://www.pdfScripting.com]pdfscripting.com[/url]

The Acrobat JavaScript Reference, Use it Early and Often
[url=http://www.adobe.com/devnet/acrobat/javascript.php]http://www.adobe.com/devnet/acrobat/javascript.php[/url]

Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script