Hi all,
Following is routine that performs some form validation. The routine is called in the form tag:
<form id="dls_form" method="post" action="enroll_method.php" onSubmit="return checkform(this)">
The routine works perfect in IE and is completely ignored in FF or Netscape. Any idea why? Here is the routine. Thanks!
function checkform(form1) {
var good_form = false;
var advanced = false;
for (var i=0;i<dls_form.elements["course_single"].length; i++){
//alert ("here");
if (dls_form.elements["course_single"].checked==true) {
good_form=true;
}
}
if (document.getElementById("course_multiple_50").checked==true) {
good_form=true;
advanced=true;
}
if (document.getElementById("course_multiple_51").checked==true) {
good_form=true;
advanced=true;
}
if (document.getElementById("course_multiple_52").checked==true) {
good_form=true;
advanced=true;
}
if (document.getElementById("course_multiple_53").checked==true) {
good_form=true;
advanced=true;
}
if (document.getElementById("course_multiple_54").checked==true) {
good_form=true;
advanced=true;
}
if (document.getElementById("course_multiple_55").checked==true) {
good_form=true;
advanced=true;
}
if (document.getElementById("course_multiple_56").checked==true) {
good_form=true;
advanced=true;
}
if (advanced==true && (dls_form.elements["payplan"][1].checked==true || dls_form.elements["payplan"][2].checked==true)) {
alert ("SLM and VA payment options apply only to courses 01-05");
return false;
}
if (!good_form==true) {
alert ("Must select at least one course");
return false;
}
if ((dls_form.elements["country"]!=="United States") && (dls_form.elements["payplan"][1].checked==true)) {
alert ("SLM Career Training Loans are only available for residents of the United States.");
return false;
}
return true;
}
</script>
Following is routine that performs some form validation. The routine is called in the form tag:
<form id="dls_form" method="post" action="enroll_method.php" onSubmit="return checkform(this)">
The routine works perfect in IE and is completely ignored in FF or Netscape. Any idea why? Here is the routine. Thanks!
function checkform(form1) {
var good_form = false;
var advanced = false;
for (var i=0;i<dls_form.elements["course_single"].length; i++){
//alert ("here");
if (dls_form.elements["course_single"].checked==true) {
good_form=true;
}
}
if (document.getElementById("course_multiple_50").checked==true) {
good_form=true;
advanced=true;
}
if (document.getElementById("course_multiple_51").checked==true) {
good_form=true;
advanced=true;
}
if (document.getElementById("course_multiple_52").checked==true) {
good_form=true;
advanced=true;
}
if (document.getElementById("course_multiple_53").checked==true) {
good_form=true;
advanced=true;
}
if (document.getElementById("course_multiple_54").checked==true) {
good_form=true;
advanced=true;
}
if (document.getElementById("course_multiple_55").checked==true) {
good_form=true;
advanced=true;
}
if (document.getElementById("course_multiple_56").checked==true) {
good_form=true;
advanced=true;
}
if (advanced==true && (dls_form.elements["payplan"][1].checked==true || dls_form.elements["payplan"][2].checked==true)) {
alert ("SLM and VA payment options apply only to courses 01-05");
return false;
}
if (!good_form==true) {
alert ("Must select at least one course");
return false;
}
if ((dls_form.elements["country"]!=="United States") && (dls_form.elements["payplan"][1].checked==true)) {
alert ("SLM Career Training Loans are only available for residents of the United States.");
return false;
}
return true;
}
</script>