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

Script when checkBox is checked

patra
Registered: Oct 19 2006
Posts: 270

Here is my scenario:
I have a check box and three fields Price, Quantity and Total.
How when the checkbox is checked I can get TotalValue=PriceValue*QuantityValue?

Thanks

try67
Expert
Registered: Oct 30 2008
Posts: 2399
In TotalValue's custom calculation field you can check the state of the check-box, and set its value based on that.

- AcrobatUsers Community Expert - Contact me personally at try6767 [at] gmail [dot] com
Check out my custom-made scripts website: http://try67.blogspot.com

patra
Registered: Oct 19 2006
Posts: 270
I am trying without luck the custom script calculation below for the Total Field.
What I am doing wrong?


var price = this.getField("price")
var qty = this.getField("Qty")

if (CheckBox.value =1)

event.value = price.value * qty.value

else

event.value = ""
try67
Expert
Registered: Oct 30 2008
Posts: 2399
1. I don't see where you define the variable "CheckBox".
2. For comparisons, use ==, not =.
3. When checking a value of a field, you're better off using strings, not numbers.

- AcrobatUsers Community Expert - Contact me personally at try6767 [at] gmail [dot] com
Check out my custom-made scripts website: http://try67.blogspot.com

patra
Registered: Oct 19 2006
Posts: 270
Now is working!
Thanks for your help!

var price = this.getField("price.0")
var qty = this.getField("Qty.0")
var Ca = this.getField("Ca")

if (Ca.value ==1)

event.value = price.value * qty.value
else

event.value = ""