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

Calculating checkboxes

Elya42
Registered: Mar 3 2009
Posts: 59
Answered

I have 4 checkboxes and I need to be able to sum the number of checkboxes that are checked. I have tried a couple of different scripts but I cannot get it work work. Can anyone help me with a script for this?

Elaine M

My Product Information:
Acrobat Pro 9.1, Macintosh
Dimitri
Expert
Registered: Nov 1 2005
Posts: 1389
Hi Elya42,

Where is the value of the summed checkboxes reported? If you want the number of checkboxes checked shown in another field, you could set the export value of each checkbox to 1 (in Properties under the Options tab) and use Simplified Field Notation to add them up in the Calulation tab of the result field.


Hope this helps,

Dimitri
WindJack Solutions
www.windjack.com
www.pdfscripting.com
Elya42
Registered: Mar 3 2009
Posts: 59
The value of the summed checkboxes will be reported in a text box futher down the form. I do have the export value set. I guess I am not sure of the script to use in the Simplified Field Notation.

I am a novice at script and I know that one little thing off and nothing works

I so appreciate your help

Elaine M

Dimitri
Expert
Registered: Nov 1 2005
Posts: 1389
Hi Elya42,

Actually, no need for Simplified Field Notation at all in this case. Try this- in edit mode right click on the text box and select Properties. In the Calculate tab select the radio button "Value is the" and choose "Sum +" Then click the Pick button, and select all of the checkboxs from the list you want to add. Close that dialog then test it out.

Hope this helps,

Dimitri
WindJack Solutions
www.windjack.com
www.pdfscripting.com
Elya42
Registered: Mar 3 2009
Posts: 59
I am sorry, I must be dense. I can right-click next the the textbox and select properties but there is no 'radio button' to select in the Calculate tab.

The Checkboxes do not have a Calculate tab either.
I appoligize for all the trouble.

Elaine M

Dimitri
Expert
Registered: Nov 1 2005
Posts: 1389
Hi Elya42,

What do you see under the Calculation tab in the Properties dialog for the text field?

No need to mess with the checkboxes- the only field you need for adding the number of boxes checked is the text field.

Hope this helps,

Dimitri
WindJack Solutions
www.windjack.com
www.pdfscripting.com
gkaiseril
Online
Expert
Registered: Feb 23 2006
Posts: 4307
You highlight the text field, then use the right mouse click to bring up the context menu and select the "Properties" menu option. You should now have a pop-up window titles "Text Field Properties" and there will be a number of tabs across the top. Select the "Calculate" tab and you should see 4 radio button options. You can select the "Value is the sum (+) of the following fields:" or the "Simplified field Notation:".

See [url=http://www.acrobatusers.com/tutorials/2006/scripts_form_fields]Entering scripts for form fields[/url] for another method to access a field's propety

George Kaiser

Elya42
Registered: Mar 3 2009
Posts: 59
I have used the "Value is the sum (+) and then selected the checkboxes for the total and nothing happens in the field when I test it. I wish I could figure what I am doing wrong.

Elaine M

gkaiseril
Online
Expert
Registered: Feb 23 2006
Posts: 4307
Are you getting any errors in the JavaScript debugging console?

[url=http://forums.adobe.com/thread/417272]Sum Check Boxes[/url] is a working example that uses the Sum (+) and custom calculation scripts.

George Kaiser

Elya42
Registered: Mar 3 2009
Posts: 59
I finally got it! It works perfectly!!!!!!!!! Thank you so very much!!!!!!!!!!!!!!!!!

Elaine M