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

Disable calculated field with a checkbox

tgaspard
Registered: Aug 17 2011
Posts: 15

I am creating an order form for the guys in our shop. The form includes calculations for rental rates, complete with subtotals, misc charges, and tax. Some of our clients are tax-exempt, though...so I'd like to disable the tax fields (which are added into the projected total fields via a formcalc script) if the tax exempt checkbox is checked.
 
I've tried the following script on the click event with no success:
if (this.rawValue == 1) {
 
dropDown1.access = "protected";
 
}
 
I have 3 subtotal fields, 3 tax fields and 3 projected total fields (each corresponding to the daily, weekly and monthly subtotals)
 
Ideally, I'd like the user to be able to see the taxes and have them added into the projected totals, but, if they check the tax exempt box, the tax fields (and their calculations) should be disabled/rendered as 0.
 
Any help would be appreciated.

-tina

My Product Information:
LiveCycle Designer, Windows
gkaiseril
Online
Expert
Registered: Feb 23 2006
Posts: 4307
I would be checking the check box value within the script for the calculation of the field and depending upon the value, either perform the calculation or set the field value to null or zero, effectively skipping the calculation and the addition of the the sales tax.

George Kaiser

tgaspard
Registered: Aug 17 2011
Posts: 15
I've tried that with this script:
if ( CheckBox6=1) then
tax1=0
[ else
tax1=subtotal1*.09]
endif

Didn't work.

-tina

gkaiseril
Online
Expert
Registered: Feb 23 2006
Posts: 4307
And did you get any errors with your code?

I receive a syntax error message about using the "=", set operator. in the comparison test statemt of the 'if' statement and not the equality operator, "==".

After correcting the comparison, I then get a syntax error about the use of the "[" charater.
This is the indicator of optional code or parameters from the syntax of the 'if' statement. You do not include them in the code if you use the optional items. Also the "|" symbol is use to list a choice of items and is described as the OR choice and also is not icluded when one of the choice items is included.

if (CheckBox6 == 1) then
$ = 0
else
$ = subtotal1 * 0.09
endif

or without the else clause

var tax = subtotal1 * 0.09
if(CheckBox6 == 1) then
tax = 0
endif
tax

So you do not even need to use the 'else' block of coding.


George Kaiser

tgaspard
Registered: Aug 17 2011
Posts: 15
George,
I didn't get an error message when I used the previous code, but the field was blank no matter what info i put on the form.

I tried your code in both the click and calculate events...as both formcalc and javascript...and still the field just shows up blank no matter what else i enter/check or uncheck.

-tina

tgaspard
Registered: Aug 17 2011
Posts: 15
Just bumping this up to see if the afternoon crew has any other suggestions. :)

-tina

gkaiseril
Online
Expert
Registered: Feb 23 2006
Posts: 4307

George Kaiser

tgaspard
Registered: Aug 17 2011
Posts: 15
Perfect! Thanks so much!

-tina

gvilla
Registered: Nov 12 2007
Posts: 5
Hey,

I'm using Acrobat Pro X on a MAc, and, for some reason I can not edit the PDF file to see the code used... it says something about xml file not compatible...

Please help!

Thanks!

Gvilla.


Hell-o!