Expand my Community achievements bar.

Validation failed when I did not specified one

Avatar

Former Community Member
I always kept getting a validation failed one a Text Type field. However, I did not specified a validation pattern and/or check the error check box. So why is the application kept giving me a validation failed? Help is appreciated.
2 Replies

Avatar

Former Community Member
By the way, I do have the following javascript assigned to this field:



----- F.P2.StoutID::validate - (JavaScript, client) -----------------



if (this.rawValue != null) {

var ID = this.rawValue;

var ValidChars = "0123456789";

var IsNumber=true;

var Char;



for (var i = 0; i < ID.length && IsNumber == true; i++){

Char = ID.charAt(i);

if (ValidChars.indexOf(Char) == -1){

IsNumber = false;

}

}



if (IsNumber == false){

xfa.host.messageBox(ID + " is not a numeric ID. Please enter a numeric ID");

xfa.host.setFocus(this.somExpression);

}

}



Whenever I typed in "0" (zero) at the end of the field is when I received the stoutID validate failed message. The error only occurs when the zero is at the end.

Avatar

Former Community Member
Using isNan() solves the problem but I was curious as to why the script I used triggerd the validate failed message.