Link to home
Start Free TrialLog in
Avatar of go4java
go4java

asked on

Acrobat 6: Field validation

I need to validate a field onBlur with JScript:

- should be numeric (1 to 9999999999)
- spaces should be trimmed

Thanks.
Avatar of Karl Heinz Kremer
Karl Heinz Kremer
Flag of United States of America image

Do you want the user to enter spaces? The most straight forward approach would be to only allow numeric information to be entered. You can do this by opening the properties dialog for your field. Then select the "Format" tab and select the format category "Number". Specify how many decimal places, then select the "Validation" tab and specify the limites (1 to 9999999999).

If this is not sufficient, I can give you more information about how to do this with JavaScript.
Avatar of go4java
go4java

ASKER

Is more a regular expression: The first char should be 1 to 9 (not 0!) and the follwoing 9 chars should be 0 to 9.
Examples:
123456
234
99999999
ASKER CERTIFIED SOLUTION
Avatar of Karl Heinz Kremer
Karl Heinz Kremer
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of go4java

ASKER

Thank you,
I found the workaround:

1. onBlur

- conversion if field content to String! (--> 01 will not be parsed to 1)
var sNodeString = sNode.valueAsString;

2. Test field content with regular expression

var regExpr =  /^[1-9][0-9]{0,9}$/;