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

Trying to hide 0 value--now it doesn't show, EVER.

407chelsie
Registered: Dec 8 2008
Posts: 68

I have three radio buttons with number values and need to display the value if one is selected. If none are selected, I need to hide the 0.00 value.

ALSO,
I have three check boxes with number values and need to display the total of these values if one is selected. If none are selected, I need to hide the 0.00 value.

Here's what I tried for the radio buttons:

var mem_class = this.getField("Membership Classification");
mem_class.display = dispay.hidden; 
 
if (mem_class > "0") 
{
mem_class.display = display.visible
}

Here's what I tried for the check boxes:
var ceesp = +getField("Chief Audit Executive Services Program").value;
var fsag = +getField("Financial Services Auditor Group").value;
var gag = +getField("Gaming Audit Group").value;
 
if (ceesp + fsag + gag > "0") 
{
this.getField(event.target.name).display = display.visible;
} else {
this.getField(event.target.name).display = display.hidden;
}
event.value = +ceesp + fsag + gag;

Not only are my totals invisible--permanently, I now get an error "The value entered does not match the format of the field [Specialty Membership Total]" (which is the total of the three check boxes).
Can anyone help me?

My Product Information:
Acrobat Pro 8.1.2, Macintosh
George_Johnson
Expert
Registered: Jul 6 2008
Posts: 1876
When a check box is unchecked or no radio buttons in a group is selected, the value of the field will be equal to the string "Off". When you attempt to convert the string "Off" to a number using the unary + operator as you are in the code you posted, the result is "NaN", which means "Not a Number". So the result of your calculation is not a number, but yo're expecting it to be. What you need to do is only perform the addition if each of the field values is not "Off". If you need help with the code, post again.


George
407chelsie
Registered: Dec 8 2008
Posts: 68
This [i]Java for Dummies[/i] book is useless. So yes, this dummy needs help with code. Thank you so much.
gkaiseril
Online
Expert
Registered: Feb 23 2006
Posts: 4307
"Java for Dummies" is for the Java language and not JavaScript. Also, Acrobat JavaScript covers many standards and Acrobt JavaScript uses one of those standards and adds some of its own methods and properties, so "Java for Dummies" is dumb about Acrobat JavaScript.

Answered the earlier post, [url=http://www.acrobatusers.com/forums/aucbb/viewtopic.php?id=17950]calculating value of check boxes AND hiding if 0[/url], dealing with this exact problem.

George Kaiser

407chelsie
Registered: Dec 8 2008
Posts: 68
Sorry for the double post. I'm juggling so many forms here, I'm loosing track of my problems.

No wonder I'm struggling. I have the wrong book! Thanks, I'm hitting amazon.com right now.