The code below validates my survey questions to ensure that the responder has answered all the questions before submitting the survey. If one selects "No Contact' on a drop down menu with the first question, it will not require the responder to answer the next 5 questions, but if the responder selected other response other than "No Contact" (say "1 to 4 times", or "More than 5 times"), this code will ensure that the responder to answer the next 5 questions. The problem with this code is that if a responder selects "No Contact", it will not do anything while I would like for it to go on and check/validate the 6th and rest questions and if all is ok, submit the survey at the end. It must be something to do with bracket location or something like that? I used pop up alert "Done" on the code below for testing purpose only. Is there anyone who can detect the bug and help me? It would be greatly appreciated. Thanks!
<SCRIPT language="Javascript">
function SubmitSurvey() {
if ((form1.CHR_dealt.value != "No Contact")) {
O=0, T=0, R=0, K=0, A=0, H=0, C=0
for (var i = 0; i < 6; i++) {
if (form1.CHR_overall.checked==true) O = O+1
if (form1.CHR_time.checked==true) T = T+1
if (form1.CHR_res.checked==true) R = R+1
if (form1.CHR_know.checked==true) K = K+1
if (form1.CHR_acc.checked==true) A = A+1
if (form1.CHR_help.checked==true) H = H+1
if (form1.CHR_court.checked==true) C = C+1 }
if (O==0 || T==0 || R==0 || K==0 || A==0 || H==0 || C==0) {
alert ('Please ensure you have answered all questions about the Immediate Office, Center for Human Resources.')
window.location='#CHR'}
else {
alert ('Done')}
}
<SCRIPT language="Javascript">
function SubmitSurvey() {
if ((form1.CHR_dealt.value != "No Contact")) {
O=0, T=0, R=0, K=0, A=0, H=0, C=0
for (var i = 0; i < 6; i++) {
if (form1.CHR_overall.checked==true) O = O+1
if (form1.CHR_time.checked==true) T = T+1
if (form1.CHR_res.checked==true) R = R+1
if (form1.CHR_know.checked==true) K = K+1
if (form1.CHR_acc.checked==true) A = A+1
if (form1.CHR_help.checked==true) H = H+1
if (form1.CHR_court.checked==true) C = C+1 }
if (O==0 || T==0 || R==0 || K==0 || A==0 || H==0 || C==0) {
alert ('Please ensure you have answered all questions about the Immediate Office, Center for Human Resources.')
window.location='#CHR'}
else {
alert ('Done')}
}