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

Mileage form problems

jetbtwo
Registered: Sep 28 2007
Posts: 14

I have created a Mileage form. I created an XML file with all the appropriate destinations and miles and imported that into Designer. I have a drop down box that allows the user to choose the destination and the appropriate mileage populates the adjacent box. I need to have a round trip check box next to that field so that when checked the mileage doubles and is placed in the total miles field next to that. (or isn't doubled if not checked and the regular mileage is placed in the total miles column.)

Date - Destination - Mileage - Round Trip - Total Miles

*My script for the check box that doubles mileage*

if (this.rawValue == "1") then

NumericField3.rawValue == Mileage.rawValue *= 2

else

NumericField3.rawValue == Mileage.rawValue

jetbtwo
Registered: Sep 28 2007
Posts: 14
I tried rewriting the script from Javascript to FormCalc. It's still not working and RoundTrip is giving me a syntax error. I have no idea why this shouldn't be working.

RoundTrip is a checkbox.

This is what I have:

if RoundTrip = "1"

then

NumericField3 = Mileage * 2

else

NumericField3 = Mileage

endif
gkaiseril
Online
Expert
Registered: Feb 23 2006
Posts: 4307
A quick check of the "Scripting Reference" in LiveCycle Designer shows the syntax for the "if" statement as:

if ( simple expression ) then
list of expressions
elseif ( simple expression ) then
list of expressions
else
list of expressions
endifThe "==" or "eq" is the comparative equality operator and "=" is the set value operator. The FormCalc function "Str()" converts a number to a string.

So your use should read:

if ( Str($.rawValue) == "1" ) then
NumericField3.rawValue = Mileage.rawValue * 2
else
NumericField3.rawValue = Mileage.rawValue
endif

George Kaiser

jetbtwo
Registered: Sep 28 2007
Posts: 14
Thank you. I finally managed to fix the formula.

Now my problem is...using Adobe Reader 8.1.... I open up the form I dynamically have a button that adds a line so that each user can add more than one trip to the mileage form. Once I save the form and open it again every trip is gone except for the original line. I used Acrobat Professional to enable reader to save the form.

Any thoughts?