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

Required Text Field

buddenceq
Registered: Dec 3 2007
Posts: 17

Hi, I'm using acrobat 8.0 for the mac and I am creating a form where I have an "other" check box. There is a field next to it where the user can type in to be more specific.

Is there a way that makes this text field required only if the "other" check box is checked? And if they uncheck it it no longer is required anymore?

gkaiseril
Expert
Registered: Feb 23 2006
Posts: 4308
Yes, you will have to provide a script to for the check box to see if it has been checked or unchecked and then use that to set or unset the "requried" field. A simple coding trick is to do a logical compare to generate a logical "true" or "false" value which alows one not to use an "if" statement.

For the Acrobat Form Tool:

/*
Mouse Up Action:
set the "required" property of the "OtherText" field to the
result of the comparison:
"Not" value of the check box value compared to "Off"
if the check box is "Off" (not checked" the result is "false"
if the check box is checked (no matter what value) the result is "true"
*/

this.getField"OtherText").requried = !(this.getField(event.target.name).value == "Off")

Edited to add:

You also might want to add additional code to clear the text field when the check box is unchecked.

For an example in LiveCyclle Designer, see [url=http://forms.stefcameron.com/2007/08/07/what-about-the-other-field/]What About the Other Field?[/url] by Stefan Cameron.

George Kaiser