ColdFusion and Javascript not working
I have the form where I have a pair of checkboxes. 1 to insert another to verify. For example, if there are three line items, there are three checkboxes for the insert and then three checkboxes for the verify. My task is I can only submit the form if both checkboxes are checked otherwise through the error message. I have a little code. But does not seems to be working. What am I doing wrong?
<cfset lcount = #getCareManagers.recordcount#>
<script language="javascript">
function validate(){ var i; var valueDel; var valueEdit; for (i = 1; i < <cfoutput>#lcount#</cfoutput>; i++) { var valueDel = document.getElementById('ins_'+i).checked; var valueEdit = document.getElementById('verify_'+i).checked; //alert (valueDel); if(valueDel==true && valueEdit==true) { alert(valueDel); document.forms.frmCheck.submit(); } } alert('error, cannot be both checked'); return false; } </script>
<form name="frmCheck" action="checkCompletion.cfm" method="post">
<input type="checkbox" name="ins_#currentrow#" id="ins_#currentrow#" <cfif isDate(checkCompletion.completiondate)>disabled="disabled" class="green" checked</cfif>/>
<input type="checkbox" name="verify_#currentrow#" id="verify_#currentrow#" <cfif isDate(checkCompletion.completiondate)>disabled="disabled" class="green" checked</cfif>/>
<input type="submit" name="btnSubmit" id="btnSubmit" value="Complete The Course" onclick="validate ();"/>
</form>
