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

Convert text string to numerical value in dropdown list

wdrspens
Registered: Jul 22 2008
Posts: 94
Answered

I have a form with a drop down list with only three numerical values, 400, 100, 50 which will almost always be used and there is no problem with them, but very occasionally the person entering data into the form will want to enter another value, say 125. How do I convert that entered figure, which is returned as a string, to a numerical value?

I have searched LiveCycle Designer ES Scripting Reference, without success.

The field is a dropdown list field called "DamageDeposit" and I have entered £400.00, £100.00, £50.00 and " " into the List Items Text box under Object-Field, and 400, 100, 50 and 0 into the Object - Binding under "Specify Item Values", so there is no problem there. However I have allowed Custom Text Entry and get a text result when, say, 125 is entered. How do I change the entered text into a numerical value?

I cannot use a conditional statement since I have no idea what number (text) might occasionally be entered.

What I want is to give the result in the numeric field DepositDue of the FormCalc calculation DamageDeposit - DamageDepositPaid.

At the moment the DamageDeposit (if I enter any figure) is zero so the DepositDue is a negative figure equal to the negative value of the DamageDepositPaid field - a highly unsatisfactory situation.

Many thanks

David

My Product Information:
LiveCycle Designer, Windows
wdrspens
Registered: Jul 22 2008
Posts: 94
This problem has been resolved, although quite how I do not know. I tried two javascript codes using thisGetfield and they both failed, and I also tried something in formcalc which failed, but when I went back to the form, with no code at all, it all worked as I had hoped. It parsed the entry as a number!
Please don't ask me why or what happened, because I cannot replicate it and did not keep a record.
David