R
Robert Smith
I have a very basic form validation script, which wont work due to XHTML
Strict not allowing me to use the name attribute on a form. Here is part of
my code:
if (document.feedback.first_name.value == "") {
alert ('Please enter your first name.');
document.feedback.first_name.focus()
return false;
}
So I figured I'd use the id attribute instead of the name attribute, like
so:
if (document.getElementById("feedback").first_name.value == "") {
alert ('Please enter your first name.');
document.getElementById("feedback").first_name.focus()
return false;
}
which works in Mozilla, but not Internet Explorer. Internet Explorer just
ignores it and submits an invalid form. What am I supposed to do?
Strict not allowing me to use the name attribute on a form. Here is part of
my code:
if (document.feedback.first_name.value == "") {
alert ('Please enter your first name.');
document.feedback.first_name.focus()
return false;
}
So I figured I'd use the id attribute instead of the name attribute, like
so:
if (document.getElementById("feedback").first_name.value == "") {
alert ('Please enter your first name.');
document.getElementById("feedback").first_name.focus()
return false;
}
which works in Mozilla, but not Internet Explorer. Internet Explorer just
ignores it and submits an invalid form. What am I supposed to do?