<form action="" method="post">
<div align="center"><legend>Add a Code</legend>
<label for="code"></label>
<input type="text" name="code" id="code" maxlength="10" />
<input type='button'
onclick=
"isAlphanumeric(document.getElementById('code'),'Your Submission Contained Invalid Characters');
isBadPhrase(document.getElementById('code'), 'Please Enter A Correct Friend Code!');"
value='Check Field' />
function isAlphanumeric(elem, helperMsg){
var alphaExp = /^[0-9a-zA-Z]+$/;
if(elem.value.match(alphaExp)){
return true;
}else{
alert(helperMsg);
elem.focus();
return false;
}
}
function isBadPhrase(elem,helperMsg){
var badPhrase=/EPW|ESW|\s/;
if (elem.value.match(badPhrase)){
alert(helperMsg);
elem.focus();
return false;
}else{
return true;
}
}
What is wrong here?