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

How do I validate number in pdf form field with java script

zmicdog
Registered: Jan 17 2010
Posts: 6
Answered

Hi!

I am beginner in java script and I hope someone can help me. I am creating a "time sheet". I have a table with five columns. I am working with AcroForm. I have searched the Internet but not found what I am looking for. Hope you can help me!

The names of the columns in the first row in the table are:

feeRow.0.date | feeRow.0.time | feeRow.0.typeOfFee | feeRow.0.premises | feeRow.0.premisesAddition

The format category of the column "fee.0.typeOfFee" is Number with 0 decimal places.

Allowed values in fee.0.typeOfFee are: 37, 38, 39, 40, 41, 42, 43, 45, 46, 48, 49, 52, 55, 57, 68, 69, 77, 78, 79, 143, 147, 148, 149, 152, 156, 157 or 161.

1. How do I write a java script to validate data in cell fee.0.typeOfFee?
2. How do I write a message so the user knows if the data is wrong??
3. How do I pass on the state if the validation java script was successful or not?

Kind regards

Michael

My Product Information:
Acrobat Pro 9.2, Windows
gkaiseril
Expert
Registered: Feb 23 2006
Posts: 4307
You are asking for quite a bit of code. The forums are to help useres with a specific and less general coding question.

Have you looked at the tutorials, articles, and eSeminars on demand on this site?

You can access the [url=https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference]JavaScript 1.5 Reference] on line for JS syntax that is common to Acrobat JavaScript. There are links to the freely downloadable Acrobat JavaScript Reference in many of the the tutorials by Thom Parker. [url=http://oreilly.com/]O'Reilly] has a general reference and Ted Padova has written a number of books on Acrobat and Acrobat Forms.

Since you are on a Windows platform, and this is a first form, we should know if you are using AcroForms tools or LiveCycle Designer. They are 2 different products and the languages and syntax between the 2 are different.

George Kaiser