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

Calculation and Check Box Help

mhburris
Registered: Feb 19 2009
Posts: 5

First of all I am new to pdf forms, but willing to learn. I am trying to make a simple order form for our customers and here is my problem.

I have figured out the simple calculation of quantity ordered X the constant price=totals. Now the next issue I have is that I want to add a check box or a radio button to the form and if the box is checked then the price changes.

Example

(Item1 X $100 = total) If box is checked or button clicked then (Item1 X $130=Total) When box is checked then price goes from $100 to $130.

Hope this makes sense.

thanks

mhburris

mhburris
Registered: Feb 19 2009
Posts: 5
bumpy...bump....bump


can anyone help with this??

thanks


mhburris
mhburris
Registered: Feb 19 2009
Posts: 5
Pretty please....help!!
gkaiseril
Online
Expert
Registered: Feb 23 2006
Posts: 4308
The "Simplified field notation" does not support any type of JavaScript control statment, so you will need to write a "Custom calculation script".

// custom calculation script for total// adjust price if field called 'CheckBoxName' is checked - value not "Off"if(this.getField("CheckBoxName").value != 'Off') {// check so price is 130event.value = 130 * this.getField("QuantityFieldName").value ;} else {// not checked so price is 100event.value = 100 * this.getField("QuantityFieldName").value ;}

George Kaiser

pdfer
Registered: Dec 23 2010
Posts: 28
George,
There's an error in your script mentioned above. I've tried it a few different ways and the error comes back saying " } is missing ". What does this mean?

Jackson C.

gkaiseril
Online
Expert
Registered: Feb 23 2006
Posts: 4308
It appears that the text of the script has been re flowed and line feeds lost because of the update for the web server. This has caused the executable code to be run into the comment line. It should be easy enough to find where the line breaks need to insterted into the runon comments.

// custom calculation script for total
// adjust price if field called 'CheckBoxName' is checked - value not "Off"
if(this.getField("CheckBoxName").value != 'Off') {
// check so price is 130
event.value = 130 * this.getField("QuantityFieldName").value ;
} else {
// not checked so price is 100
event.value = 100 * this.getField("QuantityFieldName").value ;
}

You can always use the 'the value is the ___ (select option) fields:'.



George Kaiser