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

simple subtractions using 9 pro

bshrove
Registered: Dec 9 2010
Posts: 2

I am trying to do simple subtraction while I am making a new form and have tryed to use the ideas I have found on the web but I must not be doing it correctly.
 
this is what I have
 
start mileage_____________________
 
end mileage_______________________
  
total_________________________
 
I need to have the end mileage - start mileage would = total
 
using the text field properties caluate tab
  

My Product Information:
Acrobat Pro 9.0, Windows
gkaiseril
Online
Expert
Registered: Feb 23 2006
Posts: 4308
The literal labels do not provide the field names. Field names are required for any method of calculation.

Have you looked at the tutorials like How to do (not so simple) form calculations by Thom Parker?Have you tried the search feature of this site?

George Kaiser

bshrove
Registered: Dec 9 2010
Posts: 2
the name in the black box around the field says start mileage, end mileage and total so is that not the field name? I have tryed using the simplfied field notation as start mileage-end mileage and start mileage - end mileage but neather one will work as written, I have looked at taht post but can't find the correct answer,
gkaiseril
Online
Expert
Registered: Feb 23 2006
Posts: 4308
Simplified field notation does not directly support spaces in field names. JavaScript allows special characters like "." and " " when the special escape character, "\", precedes the special character. So you could use:

end\ mileage - start\ mileage

in the simplified field notation field.

You can use the custom calculation script but then you need to use JavaScript notation to obtain the field object and value property and use the appropriate operator. The custom JavaScript calculation could be:

event.value = this.getField('end mileage').value - this.getField('start mileage').value;



George Kaiser