Expand my Community achievements bar.

numeric limits

Avatar

Former Community Member
Hi,



every one knows that in the text fields it could be to put limits of characters, for example the fields is for five letters only so when the user accede the limit the form wouldn't allow him/she. so there is any way to do this in numeric field also throw Java codes or work around.



thank you.
1 Reply

Avatar

Former Community Member
This javascript allows for only 3 numbers (if you require 4 digits, change both values to 9999). Create a numeric field and add on the Change event the following:



if(xfa.event.newText > 999 || xfa.event.newText < -999)



{



xfa.event.change = "";



}



Explanation: This script runs whenever a change is made to the field. If the new text generated by the change is greater than 999 or less than -999 then remove the change made by setting event.change to the empty string.



hd