My form contains various controls and I opted not to use the validations provided in the Visual Studio toolbox. Instead, I have implemented validations for these controls using JavaScript. One of the validations that I have set up is a Regular Expression.
How can I verify the user's input against this regular expression?
for (i = 0; i < rows.length; i++) {
if (patterns[i] != "") {
val = document.getElementById('cntrl'+i).value;
ptrn = patterns[i];
if (!ptrn.test(val)) {
msg += "bad format. \n";
j = false;
}
}
}
I ran this code through Firebug for testing purposes and encountered an issue where it exits the second if loop after the first iteration.