You will need to use a "Regular Expression" in Javascript if you want to validate a field in this way. It will check that the string entered conforms to a specific rule, such as it contains only letters [a-z] or the numbers [0-9].
They are powerful, but the syntax can be tricky at first.
e.g. To test that the "entrantName" field contains only numbers and letters:
Code:
var nameTest = /^[a-z 0-9]+$/i;
function isValid(pattern, str) {
return pattern.test(str);
}
if (!isValid(nameTest, document.all.entrantName.value))
{
return false;
};
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.