Can this be modified to test for a specific order of characters/digits?Code:var checkOK = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; var checkStr = theForm.Alias.value; var allValid = true; for (i = 0; i < checkStr.length; i++) { ch = checkStr.charAt(i); for (j = 0; j < checkOK.length; j++) if (ch == checkOK.charAt(j)) break; if (j == checkOK.length) { allValid = false; break; } } if (!allValid) { alert("Please enter only letter and numeric characters in the \"Alias\" field."); theForm.Alias.focus(); return (false); }
I'd like to test for format: A1234567
- First character is alpha (A-Z, a-z)
- Next 7 characters are digits (0-9)
I can do this in PHP, but I'd like to know how to make it work in Javascript.
thanks!





Bookmarks