I have a form that I am checking to see if a check box is checked. If it is not checked an alert pops up with an error message and when I click OK It checks the check box.
This is very weird. Code below
function isNumeric(elem, helperMsg){
var numericExpression = /^[0-9]+$/;
if(elem.value.match(numericExpression)){
return true;
}else{
alert(helperMsg);
elem.focus();
return false;
}
}
function ischecked(elem, helperMsg){
if(elem.checked == true){
return true;
}else{
alert(helperMsg);
elem.focus();
return false;
}
}
//document.myform.box1.checked == false
function chkFormmt(frm){
if(isNumeric(frm.homevalue, "Please enter a number for your Home Value")){
if(isNumeric(frm.numautos, "Please enter a number for your number of Vehicles")){
if(isNumeric(frm.avgvalue, "Please enter a number for your average vehicle value")){
if(ischecked(frm.checkbox, "You must check that you have read the disclamer")){
return true;
}
}
}
}
alert("here");
return false;
}