Acrobat User Community Forums

You are not logged in.     Log in to your AUC account.     Don't have an account? Sign up today

#1 2008-01-09 11:03:19

aimer5
Member
Registered: 2008-01-09
Posts: 0

JavaScript for Calculated Text Field

I am making a form fillable and have a field that calculates the sum of other fields. It defaults to 0.0 when no information is entered. I have clients that would also like to print the form and fill it out manually, and I don't want that 0.0 to show. I realize I need to use a validation script to change to null if 0.0, but I am a JavaScript dummy. Could you give me the script to get this to work?


My Product Information:
Acrobat Pro 7 / Windows

Offline

 

#2 2008-01-11 19:55:38

tedpadova
Member

Registered: 2007-04-30
Posts: 69

Re: JavaScript for Calculated Text Field

Here's a script that looks at one field and if the field contents are zero, the event.value of the field containing the script is a null value (represented as: ""):

var f = this.getField("item.0");
var g = this.getField("price.0");
if (f.value !=0)
event.value = f.value * g.value;
else
event.value ="";

ted

Offline

 

Board footer

Powered by PunBB
© Copyright 2002–2005 Rickard Andersson

AcrobatUsers.com  >>  User Groups • News • Events • Articles • Blogs • How To • Resources • Member Log in