Hi,
I need to have a form button disabled until the user enters a valid email address. I get the following error message in IE6
'document.commu nity.EMAIL' is null or not an object
Not great at javascript, and any help would REALLY be appreciated.
TIA
---
Code follows:
[HTML]function checkifempty(){
var email_pattern = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
var button = document.getEle mentById("image Field");
var field_value = document.commun ity.EMAIL.value ;
if ( (document.commu nity.EMAIL.valu e == "") || (email_pattern. test(field_valu e) == false) ) {
button.disabled =true;
return false;
} else {
button.disabled =false;
}
}
if (document.all || document.getEle mentById) {
setInterval("ch eckifempty()",1 00);
}
function emailcheck(form ) {
if (document.commu nity.EMAIL.valu e == "" || document.commun ity.EMAIL.value .indexOf('@', 0) == -1)
alert("Sorry, we cannot process that request. Please try again.");
}
</script>[/HTML]
I need to have a form button disabled until the user enters a valid email address. I get the following error message in IE6
'document.commu nity.EMAIL' is null or not an object
Not great at javascript, and any help would REALLY be appreciated.
TIA
---
Code follows:
[HTML]function checkifempty(){
var email_pattern = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
var button = document.getEle mentById("image Field");
var field_value = document.commun ity.EMAIL.value ;
if ( (document.commu nity.EMAIL.valu e == "") || (email_pattern. test(field_valu e) == false) ) {
button.disabled =true;
return false;
} else {
button.disabled =false;
}
}
if (document.all || document.getEle mentById) {
setInterval("ch eckifempty()",1 00);
}
function emailcheck(form ) {
if (document.commu nity.EMAIL.valu e == "" || document.commun ity.EMAIL.value .indexOf('@', 0) == -1)
alert("Sorry, we cannot process that request. Please try again.");
}
</script>[/HTML]
Comment