Hi all
This is my first post to the list.
I am an absolute beginner with Javascript and would appreciate some help with this loop/s
I now nothing about javascript syntax can’t get it to work.
I have a form with 7 questions, each question have to be checked Yes or No (input type =radio). If the user checks Yes, I have to know if s/he checks any other control for that question (3 checkboxes + 1 textbox)
for Each question the controlnames is QAnswer1_1 (radio Yes/No), QAnswer1_2 to QAnswer1_4 (checkboxes) and QAnswer1_5 (text)
So controls for Question no 7 is named QAnswer7_1 (radio Yes/No), and so on.
So if someone can show me how to combine the counters with “pre”/”remaining” text for the controls like in the Pseudocode, you’ll save the rest of the week for me (at least).
I just can’t get to grip with this.
‘Pseudocode **********************
QAnswer[n]’_‘[i]
if QAnswer[n]’
QAnswer[n]’_'[j] ‘Are there any Checkboxes checked?
‘
[code=php]
for (var n=0;n<7;n++) { //this runs 7 times
for(var i=0;i<_frm.QAnswer1_1.length;i++) //
if(_frm.QAnswer1_1[i].checked)
_fd += “Ja/Nej: ” + _frm.QAnswer1_1[i].value + _n;
for(var i=0;i<_frm.QAnswer1_2.length;i++)
if(_frm.QAnswer1_2[i].checked)
_fd += “How Many: ” + _frm.num[i].value + _n;
}