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

Hide/Show text field depending on input

hattg
Registered: Jun 18 2009
Posts: 36

I have some check boxes that show/hide different subforms. Each subform has multiple Quantity fields for entry. I need to make it so when a quantity is entered into any of the fields in a particular subform, that the checkbox that controls that subform gets hidden. This is so that subform can't be closed when there is any data input into any quantity field.

I have this script so far as a Validation. I am using it on a subtotal field.

if (DistSubTotal.rawValue == false)
CtrlBlock.DistributionCheckbox.presence = "visible";
else
CtrlBlock.DistributionCheckbox.presence = "hidden"

It does what I need, but, every time anything is entered into a quantity field, I get a validation error that says "DistSubTotal validate failed." Should it not be a Validation? It doesn't work as a Change at all.

Thanks

gkaiseril
Expert
Registered: Feb 23 2006
Posts: 4308
The validation script is for 'validating' input and expects either a 'true' or 'flase' result. If the result is false, the validation routine failed. You might want to consider a different action like the 'mouse up' action.

George Kaiser

hattg
Registered: Jun 18 2009
Posts: 36
The subtotal field is a calculated field, so there is no user interaction. I tried using Change, but it didn't work. I am trying to make it so that when the subtotal amount changes, based on the sum of all the cost fields after quantities are entered, that the checkbox becomes invisible. And if all the quantities were deleted, or empty, the checkbox would become visible again.
gkaiseril
Expert
Registered: Feb 23 2006
Posts: 4308
The 'validation' action will not work for this action code.

What values can the field 'DistSubTotal' have?

You can check to see if a field has a value with the 'HasValue()' funciton or test if it is not zero.

George Kaiser

hattg
Registered: Jun 18 2009
Posts: 36
The values for the DistSubTotal field are either, 0/empty at first, or a sum of totals. So it will either be empty or have a running subtotal if any quantities have been entered.
MikeStoffs
Registered: Jun 19 2009
Posts: 1
Are you sure the value does not change to "null" and not false? As far as I know if you are checking for a Boolean value and it's actually null, it will return an error.

Hi!