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

Hide the "$0.00" in a field without setting to hidden?

xantotre
Registered: Mar 3 2008
Posts: 8

I've nearly completed creating an Advertising Contract but just have a few questions...

The contract has a table with 18 rows and 19 columns and so far all of my calculations are running fine. The last column is a 'Total Cost Per Line' field, which is set to 'read-only' and calculate the fields I need added. Right now I have all 18 rows in that column showing '$0.00' before anything is entered. Without setting them to hidden, is there a way I can just have those fields blank until the calculation is made?

One more question...

Near the end of the form I have a button to calculate 'Agency Commission' depending on what's in the 'Gross Total' field. Basically .15 x "grosstotal". It works but how do I tell it to put the result of that calculation in the Agency Commission field? The field should be left blank and not calculate anything unless the button is clicked.

Thank you for your time!!!

-Michael

My Product Information:
Acrobat Pro 8.1.2, Windows
gkaiseril
Expert
Registered: Feb 23 2006
Posts: 4308
Without knowing how you have summed the column of data, I would suggest you use the following script in the "Custom script" of teh "Validate" field property tag:

if (event.value == 0) event.value = "";

For the button "Mouse Up" action you need to use JavaScript to access the "grosstotal" field and the Agency Commission field:

this.getField("agencycommission").value = 0.15 * this.getField("grosstotal"),value;
// to supress a zero result:
if this.getField("agencycommission").value == 0) this.getField("agencycommission").value = "";

George Kaiser

xantotre
Registered: Mar 3 2008
Posts: 8
gkaiseril wrote:
Without knowing how you have summed the column of data, I would suggest you use the following script in the "Custom script" of teh "Validate" field property tag:if (event.value == 0) event.value = "";

For the button "Mouse Up" action you need to use JavaScript to access the "grosstotal" field and the Agency Commission field:

this.getField("agencycommission").value = 0.15 * this.getField("grosstotal"),value;
// to supress a zero result:
if this.getField("agencycommission").value == 0) this.getField("agencycommission").value = "";
Thank you for your help!

But I can't get the scripts to work. For the first one, the "Total Cost Per Line" field is a product of the fields "Rate" and "Total Spots" fields. I put the script in the validate field in properties and there were no changes.

For the other, I added a JavaScript action to the button and when I hit OK it displayed "missing ( before condition 3: at line 4"

Thanks again!


****UPDATE****
I got the first script to work!!!
Peterburger
Registered: Mar 15 2008
Posts: 12
There is a error in this script, missing ( ...

// to supress a zero result:
if this.getField("agencycommission").value == 0) this.getField("agencycommission").value = "";

should be

// to supress a zero result:
if (this.getField("agencycommission").value == 0) this.getField("agencycommission").value = "";
xantotre
Registered: Mar 3 2008
Posts: 8
Peterburger wrote:
There is a error in this script, missing ( ...// to supress a zero result:
if this.getField("agencycommission").value == 0) this.getField("agencycommission").value = "";

should be

// to supress a zero result:
if (this.getField("agencycommission").value == 0) this.getField("agencycommission").value = "";
Thank you for finding the error in the script!!!!

I entered it in along with the first half of it and now we're starting to get somewhere. But now when I click the button, I get a popup that says, "The Value entered does not match the format of the field [AGENCYCOMMISSION]".

The format for AGENCYCOMMISSION is set to Number with two decimal places and a dollar sign.

If I take the formatting off of the AGENCYCOMMISSION field and push the button, I get "NaN" in that field.

Any suggestions?