Hello there! I am trying to ensure that users only tick one combobox for each question in a questionnaire. Each set of comboboxes is given a name based on the question it belongs to.
To find out the amount of comboboxes there are for a given question I have been using document.questionnaire.1.length (where 1 is the name of every combobox in that set), however when I try and do it using the variable qnum it doesn't work at all.
Any help would be much appreciatedCode:function chkcontrol(j, qcount, qnum) { var total=0; alert("number of boxes: " + document.questionnaire.[qnum].length); var question = document.questionnaire.[qnum].length; for(var i=0; i < question; i++){ alert(qnum) if(document.questionnaire.question[i].checked){ total =total +1;} if(total > 1){ alert("Please only choose 1 answer per question") document.question[j].checked = false ; return false; } } }![]()


Reply With Quote
Bookmarks