Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

validate a numeric field

Avatar

Level 1

I'm using ES version 8.2.1

I have the following set in a numeric field:

validate  this.rawValue <= 10

The validation script error message is: You must enter a value less than or equal to $10.00

so far the above script works, but I would like to take it further.  When the above validates (lets say the client puts 11 in the field), the client gets the error message, but the value still remains at 11 and they are allowed to continue.

What I want to happen is for the error message to be displayed, but then I want the field to clear where they have to put a value = or less than is required.

I assume this may take some sort of if statement, but I don't see a wizard to help.

Also, should I upgrade to ES2 or ES3?

Thanks,

David

0 Replies

Avatar

Level 7

I would just put in the exit event of the field (in formcalc):

if ($ > 10) then

xfa.host.messageBox("You must enter a value less than or equal to $10.00",1)

$ = ""

endif