I have a web page that has javascript validation which works fine in both Chrome & firefox but does not work correctly in Internet Explorer. There is a radio button field that when checked requires further validation that a new address is entered, when all address fields are entered it should submit, only then. IE will not do this even though it validates . I have copied the code in below.
Can anyone please help & shed some light on this for me?
Thanks in advance.
Agni
//function to validate fields marked with * //that are required to be filled out function validate_required(field,alerttxt) { with (field) { if (value==null||value=="") { alert(alerttxt);return false; } else { return true; } } }
function validate_form(thisform) { with (thisform) { //validates all the fields that require input //i.e. name, address postcode etc.
if (validate_required(name,"Name must be filled out!")==false) {name.focus();return false;} { if (validate_required(address,"Address must be filled out!")==false) {address.focus();return false;} } if (validate_required(suburb,"Suburb must be filled out!")==false) {suburb.focus();return false;} { if (validate_required(postcode,"Postcode must be filled out!")==false) {postcode.focus();return false;} } if (validate_required(homephone,"Home phone must be filled out!")==false) {homephone.focus();return false;} { if (validate_required(email,"Email must be filled out!")==false) {email.focus();return false;} } if (validate_email(email,"Not a valid e-mail address!")==false) {email.focus();return false;} { if (validate_delivery(otheraddress)==true) {otheraddress.checked();return false;} } if (validate_required(street,"Please complete the details!")==false) {street.focus();return false;} { if (validate_required(suburbortown,"Suburb or town must be filled out!")==false) {suburbortown.focus();return false;} } if (validate_required(postcode1,"Please fill out postcode!")==false) {postcode1.focus();return false;} { if (validate_message(includecard)==true) {includecard.checked();return false;} } if (validate_required(myMessage,"Please fill out message!")==false) {myMessage.focus();return false;}
} } //This function is to validate the email address entered //it must contain at least @ & . //otherwise alert message will pop up
function validate_email(field,alerttxt) { with (field) { apos=value.indexOf("@"); dotpos=value.lastIndexOf("."); if (apos<1||dotpos-apos<2) {alert(alerttxt);return false;} else {return true;} } } //This function validates that the include card has been checked, //if checked there has been text entered into the myMessage field //for form to be submitted function validate_message(field,alerttxt) { with (field) { if (includecard.checked) return false; else {return true;} } } //Function to validate numbers only are entered into //numeric fields function isNumberKey(evt) { var charCode = (evt.which) ? evt.which : event.keyCode if (charCode > 31 && (charCode < 48 || charCode > 57)) return false;
return true; } //validates Other address if radio button checked //if radio button not checked validation not required function validate_delivery(field,alerttxt) { with (field) { if (otheraddress.checked) return false; else {return true;} } }
All produce at Joe’s
|
||||||||||
Menu
|
||||||||||
![]() |
![]() |
![]() |
![]() |
| Links: |
www.health.gov.au |
|
| For more information email: info@joe’s.com.au |
|
|