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

Field Letter Calculation

djfixxx
Registered: Mar 22 2007
Posts: 111

Need to know if I can create a script on a form fill for a field that, if I type the letter A in one field it will calculate times 0.485 from another field entry of 10 or 12 for mileage.
Basically if they type A = Auto and 12 for miles it will calcutate that mileage or M = Motorcycle 12 times 0.365

It professional, networking, technical, graphical, imaging, froms.

My Product Information:
Acrobat Pro 8, Windows
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
Yes you can do this, although it might be better to use radio buttons for the M/A selection. This way users can't enter invalid values.

The specifics of how you do this depend on the forms technology your are using. Was this form created in Acrobat or in LiveCycle Designer?

Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script

djfixxx
Registered: Mar 22 2007
Posts: 111
It was created in Acrobat from Word so I will have to redo the fields which is no problem. I can use what ever is easier.
Here is the form
[url=http://www.rockndj.com/ExpenseVoucher.pdf]http://www.rockndj.com/ExpenseVoucher.pdf[/url]

It professional, networking, technical, graphical, imaging, froms.

djfixxx
Registered: Mar 22 2007
Posts: 111
How would you use a Radio Button to have A = 0.485 ot M = 0.365

It professional, networking, technical, graphical, imaging, froms.

djfixxx
Registered: Mar 22 2007
Posts: 111
OK I did it both ways and it worked. I set the Vehicle.2 fields Export Values for each dropdown.
Dropdown A export value 0.485, dropdown M Export Value = 0.305.
Then for Mileage Amount I added this script.
event.value = this.getField("Vehicle.2").value*this.getField("Miles.2").value;

Miles.2 is the actual driven miles i.e. 22
and it calculates and $ amount.
Thanks for your help.

It professional, networking, technical, graphical, imaging, froms.