danilda
02-11-2003, 06:11 PM
I am trying to make sure that my users click on at least one checkbox. I borrowed some code from another posting, but can't get it to work right. I am a newbie and don't have a clue what I am doing. Any help would be appreciated.
Thanks -- Dee
========================================
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<META HTTP-EQUIV="expires" CONTENT="now">
<SCRIPT LANGUAGE="JavaScript">
function checkit(){
var count=0;
var compliment =document.cdc_form.compliment.checked;
var hcs =document.cdc_form.hcs.checked;
var nstdah =document.cdc_form.nstdah.checked;
var questions =document.cdc_form.questions.checked;
var complaint =document.cdc_form.complaint.checked;
var facilities =document.cdc_form.facilities.checked;
var publication =document.cdc_form.publication.checked;
var training =document.cdc_form.training.checked;
var comment =document.cdc_form.comment.checked;
var relay =document.cdc_form.relay.checked;
var booth =document.cdc_form.booth.checked;
var iip =document.cdc_form.iip.checked;
var hardcopy =document.cdc_form.hardcopy.checked;
var memorable =document.cdc_form.memorable.checked;
var clarification =document.cdc_form.clarification.checked;
var topics =document.cdc_form.topics.checked;
var other =document.cdc_form.other.checked;
var memo =document.cdc_form.memo.checked;
var no_response =document.cdc_form.no_response.checked;
var print_copy =document.cdc_form.print_copy.checked;
var supervisor_name =document.cdc_form.supervisor_name.selection;
if (compliment.checked){
count++
}
if (hcs.checked){
count++
}
if (nstdah.checked){
count++
}
if (questions.checked){
count++
}
if (complaint.checked){
count++
}
if (facilities.checked){
count++
}
if (publication.checked){
count++
}
if (training.checked){
count++
}
if (comment.checked){
count++
}
if (relay.checked){
count++
}
if (booth.checked){
count++
}
if (iip.checked){
count++
}
if (hardcopy.checked){
count++
}
if (memorable.checked){
count++
}
if (clarification.checked){
count++
}
if (topics.checked){
count++
}
if (other.checked){
count++
}
if (memo.checked){
count++
}
if (count == 0){
alert("Must choose at least one of the options on the form.")
return false
}
return false
}
</script>
</SCRIPT>
<cfquery name="sups" DATASOURCE="qcr_nah">
SELECT *
FROM supervisors
order by lname, fname
</cfquery>
<head>
<title>CDC NSTDAH QCR FORM</title>
</head>
<body>
<cfset user = replace(#CGI.REMOTE_USER#, "ASHA\","")>
<cfset user = "c:\inetpub\wwwroot\nstdah\files\" & #user# & ".txt">
<cffile action="READ" file="#user#" variable="dee">
<cfscript>
crlf = chr(13);
hcs_name = ListGetAt(dee, 1, crlf);
booth_no = ListGetAt(dee, 2, crlf);
email = ListGetAt(dee, 3, crlf);
</cfscript>
<cfset booth_no = replace(booth_no,"NAH-","")>
<cfset booth_no = replace(booth_no,"NAHSPAN-","")>
<b><center>CDC NSTDAH QCR FORM</center></b><p>
This form will route your questions/comments/requests (QCR) to the appropriate individual(s). Please check the appropriate box(es) and provide as many specifics as possible within the text of your message, including any requested action. When you have completed the form, click “SUBMIT” on the bottom of this screen. This will send your QCR to the HCSII, at the operations desk for processing.</em></strong><p>
<cfform action="cdc_nstdah_qcr_action_form.cfm" method="post" name="cdc_form" enablecab="Yes">
<ol>
<input type="checkbox" name="compliment" value="yes"> NSTDAH compliment (general)<br>
<input type="Checkbox" name="hcs" value="yes"> HCS Specific Compliment or Complaint (HCS specific)<br>
<input type="checkbox" name="nstdah" value="yes"> NSTDAH complaint (general)<br>
<input type="checkbox" name="questions" value="yes"> Questions/Comments on Publications<br>
<input type="checkbox" name="complaint" value="yes"> Compliment or complaint about NSTDAH referral<br>
<input type="checkbox" name="facilities" value="yes"> Memo to Facilities (Building concerns)<br>
<input type="checkbox" name="publication" value="yes"> Comment about PSA<br>
<input type="checkbox" name="training" value="yes"> Memo to Training Dept<br>
<input type="checkbox" name="comment" value="yes"> Comment/question about data collection<br>
<input type="checkbox" name="relay" value="yes"> Relay call write-up for NSTDAH TTY Service<br>
<input type="checkbox" name="booth" value="yes"> Booth resource problem (missing memos, etc. report computer/phone problems to HCSII)<br>
<input type="checkbox" name="iip" value="yes"> IIP update/correction needed (use "CDC/NPIN Database Change Form" for referral updates)<br>
<input type="checkbox" name="hardcopy" value="yes"> Hardcopy resource update/correction needed<br>
<input type="checkbox" name="memorable" value="yes"> Memorable Call Write Up<br>
<input type="checkbox" name="clarification" value="yes"> Information update/clarification needed<br>
<input type="checkbox" name="topics" value="yes"> Proposed topics for Team Meetings/Quality Assurance Question/Referral Tip of the Month<br>
<input type="checkbox" name="other" value="yes"> Other: <input type="text" name="other_text" size="90"><br>
<input type="checkbox" name="memo" value="yes"> Memo to Supervisor/Manager<p>
</ol>
HCS name: <cfoutput>#hcs_name#</cfoutput> Supervisor name: <cfselect name="supervisor_name" message="test">
<option>
<cfoutput query="sups"><option><!---This is a blank space for the list ---><br>#fname# #lname#<br></option></cfoutput>
</cfselect>
<p>
Booth No: <cfoutput>#booth_no#</cfoutput> Date: <cfoutput>#DateFormat ( Now ( ), "mm/dd/yyyy" )#
Time: #TimeFormat ( Now ( ), "hh:mm tt" )#</cfoutput><p>
<strong>Please check this box if you do not need a response: <input type="checkbox" name="no_response" value="yes"><br>
Please check this box if you would like a printed copy of the QCR. <input type="checkbox" name="print_copy" value="yes"><p></p>
</strong>
<strong>MESSAGE TEXT: <em>(If comment about referral, please include the accession number, name of organization, address, and phone number.)</em></strong><p>
<textarea cols="80" rows="10" name="message_text"></textarea><p>
<input type="hidden" name="hcs_name" value="<cfoutput>#hcs_name#</cfoutput>">
<input type="hidden" name="email" value="<cfoutput>#email#</cfoutput>">
<input type="hidden" name="dater" value="<cfoutput>#DateFormat ( Now ( ), "mm/dd/yyyy" )#</cfoutput>">
<input type="hidden" name="timer" value="<cfoutput>#TimeFormat ( Now ( ), "hh:mm tt" )#</cfoutput>">
<p>
<p>
<input type="submit" name="submit" value="submit" onClick="checkit();">
</cfform>
</body>
</html>
Thanks -- Dee
========================================
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<META HTTP-EQUIV="expires" CONTENT="now">
<SCRIPT LANGUAGE="JavaScript">
function checkit(){
var count=0;
var compliment =document.cdc_form.compliment.checked;
var hcs =document.cdc_form.hcs.checked;
var nstdah =document.cdc_form.nstdah.checked;
var questions =document.cdc_form.questions.checked;
var complaint =document.cdc_form.complaint.checked;
var facilities =document.cdc_form.facilities.checked;
var publication =document.cdc_form.publication.checked;
var training =document.cdc_form.training.checked;
var comment =document.cdc_form.comment.checked;
var relay =document.cdc_form.relay.checked;
var booth =document.cdc_form.booth.checked;
var iip =document.cdc_form.iip.checked;
var hardcopy =document.cdc_form.hardcopy.checked;
var memorable =document.cdc_form.memorable.checked;
var clarification =document.cdc_form.clarification.checked;
var topics =document.cdc_form.topics.checked;
var other =document.cdc_form.other.checked;
var memo =document.cdc_form.memo.checked;
var no_response =document.cdc_form.no_response.checked;
var print_copy =document.cdc_form.print_copy.checked;
var supervisor_name =document.cdc_form.supervisor_name.selection;
if (compliment.checked){
count++
}
if (hcs.checked){
count++
}
if (nstdah.checked){
count++
}
if (questions.checked){
count++
}
if (complaint.checked){
count++
}
if (facilities.checked){
count++
}
if (publication.checked){
count++
}
if (training.checked){
count++
}
if (comment.checked){
count++
}
if (relay.checked){
count++
}
if (booth.checked){
count++
}
if (iip.checked){
count++
}
if (hardcopy.checked){
count++
}
if (memorable.checked){
count++
}
if (clarification.checked){
count++
}
if (topics.checked){
count++
}
if (other.checked){
count++
}
if (memo.checked){
count++
}
if (count == 0){
alert("Must choose at least one of the options on the form.")
return false
}
return false
}
</script>
</SCRIPT>
<cfquery name="sups" DATASOURCE="qcr_nah">
SELECT *
FROM supervisors
order by lname, fname
</cfquery>
<head>
<title>CDC NSTDAH QCR FORM</title>
</head>
<body>
<cfset user = replace(#CGI.REMOTE_USER#, "ASHA\","")>
<cfset user = "c:\inetpub\wwwroot\nstdah\files\" & #user# & ".txt">
<cffile action="READ" file="#user#" variable="dee">
<cfscript>
crlf = chr(13);
hcs_name = ListGetAt(dee, 1, crlf);
booth_no = ListGetAt(dee, 2, crlf);
email = ListGetAt(dee, 3, crlf);
</cfscript>
<cfset booth_no = replace(booth_no,"NAH-","")>
<cfset booth_no = replace(booth_no,"NAHSPAN-","")>
<b><center>CDC NSTDAH QCR FORM</center></b><p>
This form will route your questions/comments/requests (QCR) to the appropriate individual(s). Please check the appropriate box(es) and provide as many specifics as possible within the text of your message, including any requested action. When you have completed the form, click “SUBMIT” on the bottom of this screen. This will send your QCR to the HCSII, at the operations desk for processing.</em></strong><p>
<cfform action="cdc_nstdah_qcr_action_form.cfm" method="post" name="cdc_form" enablecab="Yes">
<ol>
<input type="checkbox" name="compliment" value="yes"> NSTDAH compliment (general)<br>
<input type="Checkbox" name="hcs" value="yes"> HCS Specific Compliment or Complaint (HCS specific)<br>
<input type="checkbox" name="nstdah" value="yes"> NSTDAH complaint (general)<br>
<input type="checkbox" name="questions" value="yes"> Questions/Comments on Publications<br>
<input type="checkbox" name="complaint" value="yes"> Compliment or complaint about NSTDAH referral<br>
<input type="checkbox" name="facilities" value="yes"> Memo to Facilities (Building concerns)<br>
<input type="checkbox" name="publication" value="yes"> Comment about PSA<br>
<input type="checkbox" name="training" value="yes"> Memo to Training Dept<br>
<input type="checkbox" name="comment" value="yes"> Comment/question about data collection<br>
<input type="checkbox" name="relay" value="yes"> Relay call write-up for NSTDAH TTY Service<br>
<input type="checkbox" name="booth" value="yes"> Booth resource problem (missing memos, etc. report computer/phone problems to HCSII)<br>
<input type="checkbox" name="iip" value="yes"> IIP update/correction needed (use "CDC/NPIN Database Change Form" for referral updates)<br>
<input type="checkbox" name="hardcopy" value="yes"> Hardcopy resource update/correction needed<br>
<input type="checkbox" name="memorable" value="yes"> Memorable Call Write Up<br>
<input type="checkbox" name="clarification" value="yes"> Information update/clarification needed<br>
<input type="checkbox" name="topics" value="yes"> Proposed topics for Team Meetings/Quality Assurance Question/Referral Tip of the Month<br>
<input type="checkbox" name="other" value="yes"> Other: <input type="text" name="other_text" size="90"><br>
<input type="checkbox" name="memo" value="yes"> Memo to Supervisor/Manager<p>
</ol>
HCS name: <cfoutput>#hcs_name#</cfoutput> Supervisor name: <cfselect name="supervisor_name" message="test">
<option>
<cfoutput query="sups"><option><!---This is a blank space for the list ---><br>#fname# #lname#<br></option></cfoutput>
</cfselect>
<p>
Booth No: <cfoutput>#booth_no#</cfoutput> Date: <cfoutput>#DateFormat ( Now ( ), "mm/dd/yyyy" )#
Time: #TimeFormat ( Now ( ), "hh:mm tt" )#</cfoutput><p>
<strong>Please check this box if you do not need a response: <input type="checkbox" name="no_response" value="yes"><br>
Please check this box if you would like a printed copy of the QCR. <input type="checkbox" name="print_copy" value="yes"><p></p>
</strong>
<strong>MESSAGE TEXT: <em>(If comment about referral, please include the accession number, name of organization, address, and phone number.)</em></strong><p>
<textarea cols="80" rows="10" name="message_text"></textarea><p>
<input type="hidden" name="hcs_name" value="<cfoutput>#hcs_name#</cfoutput>">
<input type="hidden" name="email" value="<cfoutput>#email#</cfoutput>">
<input type="hidden" name="dater" value="<cfoutput>#DateFormat ( Now ( ), "mm/dd/yyyy" )#</cfoutput>">
<input type="hidden" name="timer" value="<cfoutput>#TimeFormat ( Now ( ), "hh:mm tt" )#</cfoutput>">
<p>
<p>
<input type="submit" name="submit" value="submit" onClick="checkit();">
</cfform>
</body>
</html>