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

Hidden Required Fields

Gillian
Registered: Jul 10 2007
Posts: 63

Does anyone know the code to use for the following scenario:

When a field is in a hidden subform, it's set to Object > Value > Type > User Entered - Optional.

But when the User clicks in a checkbox and that subform becomes visible, the Type changes to User Entered - Required.

Thanks in advance for your help.

-Gillian

-Gillian

My Product Information:
LiveCycle Designer, Windows
suewhitehead
Registered: Jun 3 2008
Posts: 232
Even though you are posting in the Acrobat forum, your Product Information says LiveCycle Designer 8. So I am assuming with this reply that you want the answer for use in LiveCycle Designer.

I have not had a chance to test this, but try this added to the script of your checkbox. --

The Syntax to use is:
Reference_Syntax.nullTest = "disabled | error | warning"

Example in JavaScript:
TextField1.validate.nullTest = "error";//throws an error message if the field is empty

TextField1.validate.nullTest = "disabled";// disables the nullTest so it essentially turns of the REQUIRED status.
suewhitehead
Registered: Jun 3 2008
Posts: 232
Here is the script that I got to work on my test form in LiveCycle Designer 8.2:

if (form1.P4.CustomerFields.presence == "hidden") {
form1.P4.CustomerFields.TextField4.validate.nullTest = "disabled";
}
else {
form1.P4.CustomerFields.TextField4.validate.nullTest = "error";
}
Gillian
Registered: Jul 10 2007
Posts: 63
Sue,
Where in the script window would I put your code -- under which Show event?

-Gillian

suewhitehead
Registered: Jun 3 2008
Posts: 232
You would put the script on the CHANGE event making sure to have Javascript in the LANGUAGE box and RUN AT: CLIENT

Using my example, here is how to do it:

The entire script to change Subform1 to visible or hidden and also the script to change the REQUIRED test on the TextField4 is all put in the Change event of the CheckBox8 field.

if (CheckBox8.rawValue == true)
{Subform1.presence = "visible"
}
else
{Subform1.presence = "hidden" }

if (Subform1.presence == "hidden") {
TextField4.validate.nullTest = "disabled";
}
else {
TextField4.validate.nullTest = "error";
}