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

calculating value of check boxes AND hiding if 0

407chelsie
Registered: Dec 8 2008
Posts: 68
Answered

I had this working perfectly when I used adobes features and the "$0.00" was visible. Since the client wants the "$0.00" to be hidden, I tried a custom script and failed miserably. I get two errors saying "The value entered does not match the format of the field".

Can someone take a look at the calculation scripts in the "Membership Dues Total" and "Specialty Membership Total" and tell me what I've done wrong. [url=http://idisk.mac.com:80//chelsie.hall/Public/App-ACCA-081158-2.pdf]Click here[/url] for the PDF.

Thank you.

My Product Information:
Acrobat Pro 8.1.2, Macintosh
gkaiseril
Expert
Registered: Feb 23 2006
Posts: 4308
For fields with monatary symbols, the zero value always shows. You can either hide the field for a zero value or make the font color white.

For each check box you check box or radio button you access in a custom calculation script, you need to check for the "unchecked" value of "Off".

Also you do not need to repeat the hidig/showing of fields if you are doing this in the calculation scirpt.

You may also need to set the calculation order.

George Kaiser

407chelsie
Registered: Dec 8 2008
Posts: 68
I'm afraid I'm so new to scripting that I don't know what action to take with the advice you gave me. Is there anyway you could break this down for me into elementary instructions? What script if any is in the check/radio fields and what script goes in the membership total fields?

Thanks again for your time. It's greatly appreciated.
gkaiseril
Expert
Registered: Feb 23 2006
Posts: 4308
Remove all the validation scripts from the three total fields.

Remove all the custom calculation scripts for the three total fields.

Use the following script for the 'Total' field's custom calculation scirpt:
// total membership dues custom calculation // Compute Total Membership Dues// Get number of membership dues, as a numbervar mem_dues = this.getField("Membership Classification").value;// if not a number set to zeroif (isNaN(mem_dues) == true ) mem_dues = 0;this.getField('Membership Dues').value = mem_dues;// assume field is hidden, display if none zero// get Membership dues objectvar oMem_Dues = this.getField('Membership Dues');oMem_Dues.display = display.hidden;if (mem_dues > 0)oMem_Dues.display = display.visible // compute specialty membership total // get field valuesvar ceesp = this.getField("Chief Audit Executive Services Program").value;var fsag = this.getField("Financial Services Auditor Group").value;var gag = this.getField("Gaming Audit Group").value;var spec_sum = 0;// set any non-numberic values to zeroif(isNaN(ceesp) == true) ceesp = 0;if(isNaN(fsag) == true) fsag = 0;if(isNaN(gag) == true) gag = 0;// compute valuespec_mem = Number(ceesp) + fsag + gag;this.getField('Specialty Membership Total').value = spec_mem// assume field is hidden, display if none zero// get Membership dues objectvar oSpec_Mem = this.getField('Specialty Membership Total');oSpec_Mem.display = display.hidden;if (spec_mem > 0)oSpec_Mem.display = display.visible // compute total duesevent.value = mem_dues + spec_mem;// assume field is hidden, display if none zerothis.getField(event.target.name).display = display.hidden;if (event.value > 0)this.getField(event.target.name).display = display.visible

George Kaiser

407chelsie
Registered: Dec 8 2008
Posts: 68
Yeah! THANK YOU!

Now let's see if I can duplicate it on 9 other similar forms. :)
407chelsie
Registered: Dec 8 2008
Posts: 68
New problem based on the same form. Now the client wants the application fee to be visible only after a Membership Classification is chosen, AND THEN, $25 only if the first check box is selected and $0 (visible) if any other Membership Classification is selected.

I have posted [url=http://idisk.mac.com:80//chelsie.hall/Public/App-RM-09117-2.pdf]my attempt here[/url].

Thanks for your continued help.
Thantelius
Registered: Feb 9 2010
Posts: 1
Thanks Chelsie! i've spend the whole day searching a solution like that, Works perfect for me!

407chelsie wrote:
New problem based on the same form. Now the client wants the application fee to be visible only after a Membership Classification is chosen, AND THEN, $25 only if the first check box is selected and $0 (visible) if any other Membership Classification is selected.I have posted xxxxx

Thanks for your continued help.