Hi
I have the following code on change event of a field:
//Restrict the Length to the Maximum 5
var maxLength =5;
if(xfa.event.newText.length >maxLength)xfa.event.change = "";
// restrict entry to digits
if (xfa.event.change.match(/[^A-Za-z0-9]/))
xfa.event.change = "";
and this code on the exit event of the same field
var minLength = 5;
if(this.rawValue != null){
if(this.rawValue.toString().length <minLength){
xfa.host.messageBox("Please enter a minimum of 5 digits");
xfa.host.setFocus(this);
this.rawValue = ""
}
}
else{
xfa.host.messageBox("Please enter a minimum of 5 digits");
xfa.host.setFocus(this);
this.rawValue = ""
}
this.rawValue =
this.rawValue.toUpperCase();
The validation works fine and won't accept anything less than 5 digits. But once I begin typing in the field and decide I no longer want to type in the field (its not a mandatory field) then it just wont let me out of the field. Keeps validating all the time.
Is there a way I can accept NULL values and also set the min length to 5 digits
Thanks
Andrew
Views
Replies
Total Likes
It's probably empty string not null so this line is not working as you expect:
if(this.rawValue != null){
Views
Replies
Total Likes