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

If then formula

Dawn W
Registered: Feb 2 2010
Posts: 17
Answered

I am trying to use the custom calculation script. My form has atleast 2 check boxes in each field. Next to the heading I want the text box to insert a number if any of the check boxes if the field are checked.

Can anyone help me.

My Product Information:
Acrobat Pro 9.0, Windows
Appligentdocume...
Registered: Oct 10 2008
Posts: 26
You will need to use javascript in the Custom Calculation of your text field.

Is the number you want to display the number of check boxes that are selected? Or a number value that is entered as the export value in the check boxes?

Also, what do you mean when you say 'at least 2 check boxes in each field'? Do you mean at least 2 check boxes corresponding to each text field that should display a number?

I'd be happy to help if you want to provide more information.

Appligent Document Solutions
http://www.appligent.com

Dawn W
Registered: Feb 2 2010
Posts: 17
If any of the check boxes in each field are checked the value to be displayed is a predetermined value and is not dependent on the number of boxes checked. If no check boxes are checked the displayed value should be 0.
try67
Expert
Registered: Oct 30 2008
Posts: 2398
Put this code in the field's custom calculation script:
if (this.getField("Box1").value==1 || this.getField("Box2").value==1) {event.value = 1234;} else event.value = 0;

You will need to adjust the name of the check boxes, their "on" value, and the value to be assigned when one of them is checked.

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

Dawn W
Registered: Feb 2 2010
Posts: 17
i entered the script and didnt get any errors but its not calculating anything in the text box. Is the value of a checked box 1 or yes. Or where do I set the value in the properties.
try67
Expert
Registered: Oct 30 2008
Posts: 2398
Did you adjust the names of the check boxes?

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

Dawn W
Registered: Feb 2 2010
Posts: 17
i got it to work. I changed the value of the check boxes from yes to 1 in the properties.

thanks for your help
saj
Registered: Oct 15 2008
Posts: 52
I have a similar equation as this, but I can't quite get it to work.
I want to have a calculation happen when the checkbox is selected.
Here is what I am assuming happens:

if (this.getField("Yearbook_Proof_check2").value==1 )
{event.value = <>;}
else event.value = 0;

This is the calculation to be inserted...but, I can't get the correct language to make it work.

var v1 = this.getField("PageCount").value;
var f2 = getField("Yearbook Proof Cost Static");

if (v1 > 50) f2.value = (v1 * 0.50);
else
f2.value = 25;

Can you help me figure it out?
thanks,
sara
gkaiseril
Online
Expert
Registered: Feb 23 2006
Posts: 4307
Have you looked at the response to your previous post, Check Boxes?Where very exactly are you placing this code?

Access the field while the user has focus on the field requires use of the 'event' object and not the ' field' object.


George Kaiser

saj
Registered: Oct 15 2008
Posts: 52
sorry. didn't see someone response.
I'll check it out.
thanks.
sara