nightwatch
nightwatch

Reputation: 1404

Adobe LiveCycle designer - form scripting - changing the field from optional to required

I'm trying to make a dynamic PDF form using Adobe LiveCycle designer and have a problem. I have a boolean checkbox field that decides if other text fields are required or optional. I'd like to implement this functionality using form scripting - in the 'changed' event of the checkbox field I'd like to modify other form fields so they become either required or optional. My problem is that I don't know the javascript API and can't find how to modify field 'requiredness'. Thanks for help R

BTW - I'm a beginner ind Adobe's PDF tools but this software is ] a big disappointment for me... And the developer documentation is so weak. Do you know any good online documentation of PDF forms javascript API?

Update: I know how to mark a field required - by setting its mandatory property to mandatory="error". But don't know how to make the field optional.

Upvotes: 3

Views: 9784

Answers (2)

Daniel McLellan
Daniel McLellan

Reputation: 1

Try doing:

this.getField("Field Name").required = false;

or:

this.getField("Field Name").required = true;

Upvotes: 0

stan229
stan229

Reputation: 2607

To make a field be optional you set the mandatory property of the object to "disabled"

Ex: displayObject.mandatory = "disabled"

To do so on a condition you do:

field.mandatory = (radioGroup.rawValue == 1) ? "error" : "disabled"

Where field is the field you are making required/optional and radioGroup is a conditional. In your case it would be myCheckbox.rawValue == 1

Upvotes: 6

Related Questions