VBScript count specific elements in a form

OlertyLams

New Member
I have a form which is being used as a quiz to collect answers and is generated dynamically so the number of questions is variable.I want to be able to count the number of radio button groups in the for so I can a)determine which where checked and b)be able to collect them so I can save the selected answers in a database.Is this something I should try doing in jQuery and somehow passing it to VBScript or can this be done programatically in VBScript?For reference, here's the generated HTML for an example form:\[code\]<form id="vms_quiz" method="post"><h2>Sustainable Infrastructure Quiz 1</h2><p>Phasellus ultrices nulla quis nibh. Quisque a lectus. Donec consectetuer ligula vulputate sem tristique cursus. Nam nulla quam, gravida non, commodo a, sodales sit amet, nisi.</p><!-- START QUESTION GROUP: Question #1 --><h2>Question #1</h2><p>Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas.</p><label> <input type="radio" name="Q_1" value="http://stackoverflow.com/questions/13746480/0" id="Q1C_1" akey="0" checked="false"> Who</label><label> <input type="radio" name="Q_1" value="http://stackoverflow.com/questions/13746480/0" id="Q1C_2" akey="0" checked="false"> What</label><label> <input type="radio" name="Q_1" value="http://stackoverflow.com/questions/13746480/1" id="Q1C_3" akey="1" checked="false"> Where</label><label> <input type="radio" name="Q_1" value="http://stackoverflow.com/questions/13746480/0" id="Q1C_4" akey="0" checked="false"> When</label><label> <input type="radio" name="Q_1" value="http://stackoverflow.com/questions/13746480/0" id="Q1C_5" akey="0" checked="false"> Why</label><!-- START QUESTION GROUP: Question #2 --><h2>Question #2</h2><p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit.</p><label> <input type="radio" name="Q_2" value="http://stackoverflow.com/questions/13746480/0" id="Q2C_6" akey="0" checked="false"> Who</label><label> <input type="radio" name="Q_2" value="http://stackoverflow.com/questions/13746480/0" id="Q2C_7" akey="0" checked="false"> What</label><label> <input type="radio" name="Q_2" value="http://stackoverflow.com/questions/13746480/1" id="Q2C_8" akey="1" checked="false"> Where</label><label> <input type="radio" name="Q_2" value="http://stackoverflow.com/questions/13746480/0" id="Q2C_9" akey="0" checked="false"> When</label><label> <input type="radio" name="Q_2" value="http://stackoverflow.com/questions/13746480/0" id="Q2C_10" akey="0" checked="false"> Why</label><!-- START QUESTION GROUP: Question #3 --><h2>Question #3</h2><p>Quisque sit amet est et sapien ullamcorper pharetra. Vestibulum erat wisi, condimentum sed.</p><label> <input type="radio" name="Q_3" value="http://stackoverflow.com/questions/13746480/0" id="Q3C_11" akey="0" checked="false"> Who</label><label> <input type="radio" name="Q_3" value="http://stackoverflow.com/questions/13746480/0" id="Q3C_12" akey="0" checked="false"> What</label><label> <input type="radio" name="Q_3" value="http://stackoverflow.com/questions/13746480/1" id="Q3C_13" akey="1" checked="false"> Where</label><label> <input type="radio" name="Q_3" value="http://stackoverflow.com/questions/13746480/0" id="Q3C_14" akey="0" checked="false"> When</label><label> <input type="radio" name="Q_3" value="http://stackoverflow.com/questions/13746480/0" id="Q3C_15" akey="0" checked="false"> Why</label><input name="vms_quizID" type="hidden" value="http://stackoverflow.com/questions/13746480/1"><input name="vms_videoID" type="hidden" value="http://stackoverflow.com/questions/13746480/1"><div class="frm_div"> <input id="btn_quiz_check_answers" name="btn_quiz_check_answers" type="submit" value="http://stackoverflow.com/questions/13746480/Check Answers"></div>\[/code\]
 
Back
Top