I need to be able to hide a field where a calculation script is in use until another field has a value - how can I do this?

New Here ,
Jun 25, 2018 Jun 25, 2018

Copy link to clipboard

Copied

Hello!

I'm new to javascript, so please excuse my lack of knowledge . The first field on my form can be blank or have a numeric value. That field plus about 20 others will be added together to result in a grand total. Based on what the number in that first field is, I've written a calculation script in another field to determine whether the number in that field is greater than, less than, or equal to a specific number. That's working great, except that when the form is opened, the specific number from the calculation script is showing up in that calculated field. I want the calculated field to be blank unless something there is an amount in the grand total on the form. The number printing in the calculated field (which happens to be the last field on the form) is currently -12.00 until a number is entered in any of the 20 or so fields; as soon as any of them has a value entered, I want the calculated field to begin showing it's calculated number. Could I use a validation script to do that? I've tried several with no luck.

Thanks in advance for any assistance you can give me!

Kim

TOPICS
Acrobat SDK and JavaScript, Windows

Views

73

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Most Valuable Participant ,
Jun 26, 2018 Jun 26, 2018

Copy link to clipboard

Copied

LATEST

You can add a condition to the script so that it doesn't display anything until there's a value in the total field.

Something like this:

if (this.getField("Total").valueAsString=="") event.value = "";

else {

     // perform rest of calculation

}

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines