Validering af checkboxe
Hejsa eksperter,Jeg kan bare ikke få dette script til at validere mine checkboxe, er der evt. nogle af jer som kan hjælpe. Jeg er helt blank :O
--------------------------------------------------------
<SCRIPT language=JavaScript type=text/JavaScript>
function MM_validateForm() { //v4.0
var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
if (val) { nm=val.name; if ((val=val.value)!="") {
if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
} else if (test!='R') { num = parseFloat(val);
if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
min=test.substring(8,p); max=test.substring(p+1);
if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
} } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }
} if (errors) alert('The following error(s) occurred:\n'+errors);
document.MM_returnValue = (errors == '');
}
//-->
</SCRIPT>
--- her er formen --------------------------------
<form action="sendmessage.asp" method="post" name="form1" onSubmit="MM_validateForm('Last_Name','','R','First_Name','','R','Social_Security_Number','','R','Present_Address_Street_City_State_Zip','','R','Permanent_Address_Street_City_State_Zip','','R','Phone_Number','','R','1_certify_that','','R');return document.MM_returnValue">
--- her er mine checkboxe --------------------------
<input name="1_certify_that" type="checkbox" id="1_certify_that" value="yes">
<input name="2_authorize_investigation" type="checkbox" id="2_authorize_investigation" value="yes">
<input name="3_also_understand_and" type="checkbox" id="3_also_understand_and" value="yes">
<input name="4This_waiver_does_not" type="checkbox" id="4This_waiver_does_not" value="yes">
<input name="5Applicant_must_che" type="checkbox" id="5Applicant_must_che" value="yes">
På forhånd mange tak!
