Expand my Community achievements bar.

Conditionally Required Fields

Avatar

Former Community Member

Basics -

Running LC ES 8.2 and Acrobat 9 Pro

Novice/Beginner in JavaScripting as a whole, especially as pertains to PDFs

Situation -
Trying to set up a form wherein a field is required if one option from a combo box is selected and to either be optional or removed otherwise.

I've been trying "if ... else" statements without any luck. The field (AbortRchgSA/#8) is set as Visible and not required by default. The combo box (Mode/#16) is a required field. My attempts have taken two forms.

Form 1:

var f = this.getField("Mode").value;

if (f = SA)

{var g = this.getField("AbortRchgSA");

g.required = true;}

Form 2:

if (this.Field.Mode.value == SA)

this.getField(“AbortRchgSA”) = required;

else

this.removeField(“AbortRchgSA”);

Any and all help is welcome.

4 Replies

Avatar

Former Community Member

You are writing/using the AcroForm model ...have you built your form in LiveCycle Designer or in Acrobat?

Paul

Avatar

Former Community Member

Created the form in Word 2003 and imported it to Acrobat.

I've been using Acrobat to edit the form thusfar.

Avatar

Former Community Member

Then you are posting on the wrong forum .....you shoudl be posting to the Acrobat forum .....this one os for forms designed with LiveCycle Designer....sorry for the confusion.

Paul

Avatar

Former Community Member

Got it, I'll move the post over that-a-way.

Thanks