Validating a form is not working. Below you see the code and error message.
Don’t think its a problem with JS, Chrome and Firefox point to the HTML part.
See screenshot I made from Firefox’ Firebug.

HTML:
<div>Enter your state code:<input id="state" name="state" type="text" size="2" onblur="isStateOk(this.document.getElementById("state_help"));"/>
<span id="state_help"></span></div>
Javascript:
function isStateOk(inputField, helpId) { // See if the input value contains any text
return editNodeText (/^A[LKSZRAEP]|C[AOT]|D[EC]|F[LM]|G[AU]|HI|I[ADLN]|K[SY]|LA|M[ADEHINOPST]|N[CDEHJMVY]|O[HKR]|P[ARW]|RI|S[CD]|T[NX]|UT|V[AIT]|W[AIVY]$/, inputField.value, helpId, "Enter a State Code in Uppercase (Ex.NY, PA, CA)");
}
Note: eclipse show a red dotted line under: (“state_help“). Maybe the id of the span cannot be found at all? I do get code assistance though when start typing state_
UPDATE: JAVASCRIPT FILE: NEW ERROR MESSAGE POINTING TO THE FIRST FUNCTION IN THIS FILE BELOW:
function editNodeText(regex, input, helpId, helpMessage) { // See if the visitor entered the right information
if (!regex.test(input)) { // If the wrong information was entered, warn them
if (helpId != null)
while (helpId.firstChild) // Remove any warnings that may exist
helpId.removeChild(helpId.firstChild);
helpId.appendChild(document.createTextNode(helpMessage)); // Add new warning
return false;
} else { // If the right information was entered, clear the help message
if (helpId != null){
while (helpId.firstChild) // Remove any warnings that may exist
helpId.removeChild(helpId.firstChild);
}
return true;
}
}
//inputField – ID Number for the html text box
//helpId – ID Number for the child node I want to print a warning in
//See if the input value contains any text
function isTheFieldEmpty(inputField, helpId) {
return editNodeText(/^[A-Za-z\.\' \-]{2,15}\s?[A-Za-z\.\' \-]{2,15}\s?[A-Za-z\.\' \-]{2,15}/, inputField.value, helpId, "Please enter a valid name.");
} // inputField.value – Value typed in the html text box
function isAddressOk(inputField, helpId) { // See if the input value contains any text
return editNodeText(/^[A-Za-z0-9\.\' \-]{5,30}$/, inputField.value, helpId, "Enter a Street (Ex.1234 Main St.)");
}
function isStateOk(inputField, helpId) { // See if the input value contains any text
return editNodeText (/^A[LKSZRAEP]|C[AOT]|D[EC]|F[LM]|G[AU]|HI|I[ADLN]|K[SY]|LA|M[ADEHINOPST]|N[CDEHJMVY]|O[HKR]|P[ARW]|RI|S[CD]|T[NX]|UT|V[AIT]|W[AIVY]$/, inputField.value, helpId, "Enter a State Code in Uppercase (Ex.NY, PA, CA)");
}
function isPhoneOk(inputField, helpId) { // See if the input value contains any text
return editNodeText(/^([0-9]( |-)?)?(\(?[0-9]{3}\)?|[0-9]{3})( |-)?([0-9]{3}( |-)?[0-9]{4}|[a-zA-Z0-9]{7})$/, inputField.value, helpId, "Enter a Phone Number (Ex.412-828-3000)");
}
function isEmailOk(inputField, helpId) { // See if the input value contains any text
return editNodeText(/^[A-Za-z0-9._-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$/, inputField.value, helpId, "Enter an Email (Ex. cimdata@javascript.de)");
}
Use single quotes for JS strings contained within an html attribute’s double quotes or the result is unparseable;
From:
to: