Mallika Posted January 25, 2013 Report Share Posted January 25, 2013 Hi There, I need to create an online test Datapage to access the subject expertise of the applicants who wish to register with our website to teach. For this I have created a Custom HTML Page with following code <head> <h1> Mentor Algebra Test </h1> <script> function checkfornull() { var sel1 = 0, sel2=0 ,sel3=0 ,sel4=0, sel5=0; for (var i = 1; i<=4; i++) { if (document.getElementById('q1a'+i).checked) { sel1 = i; break; } } for (var i = 1; i<=4; i++) { if (document.getElementById('q2a'+i).checked) { sel2 = i; break; } } for (var i = 1; i<=4; i++) { if (document.getElementById('q3a'+i).checked) { sel3 = i; break; } } for (var i = 1; i<=4; i++) { if (document.getElementById('q4a'+i).checked) { sel4 = i; break; } } for (var i = 1; i<=4; i++) { if (document.getElementById('q5a'+i).checked) { sel5 = i; break; } } if (sel1 == 0 || sel2 == 0 || sel3 ==0 || sel4==0 || sel5==0) { alert("Please answer all the questions"); return false; } else { alert(sel1+' '+sel2+' '+sel3+' '+sel4+' '+sel5); document.getElementById("Virtual1").value=sel1; document.getElementById("Virtual2").value=sel2; document.getElementById("Virtual3").value=sel3; document.getElementById("Virtual4").value=sel4; document.getElementById("Virtual5").value=sel5; }; } </script> </head> <h2> Please answer the Questions below</h2> <form> <h3>Question number one really long and eloberate</h3> <input type="radio" name="q1" id="q1a1">Multiple choice1 <input type="radio" name="q1" id="q1a2">Multiple choice2 <input type="radio" name="q1" id="q1a3">Multiple choice3 <input type="radio" name="q1" id="q1a4">Multiple choice4 <h3>Question number two really long and eloberate</h3> <input type="radio" name="q2" id="q2a1">Multiple choice1 <input type="radio" name="q2" id="q2a2">Multiple choice2 <input type="radio" name="q2" id="q2a3">Multiple choice3 <input type="radio" name="q2" id="q2a4">Multiple choice4 <h3>Question number three really long and eloberate</h3> <input type="radio" name="q3" id="q3a1">Multiple choice1 <input type="radio" name="q3" id="q3a2">Multiple choice2 <input type="radio" name="q3" id="q3a3">Multiple choice3 <input type="radio" name="q3" id="q3a4">Multiple choice4 <h3>Question number four really long and eloberate</h3> <input type="radio" name="q4" id="q4a1">Multiple choice1 <input type="radio" name="q4" id="q4a2">Multiple choice2 <input type="radio" name="q4" id="q4a3">Multiple choice3 <input type="radio" name="q4" id="q4a4">Multiple choice4 <h3>Question number five really long and eloberate</h3> <input type="radio" name="q5" id="q5a1">Multiple choice1 <input type="radio" name="q5" id="q5a2">Multiple choice2 <input type="radio" name="q5" id="q5a3">Multiple choice3 <input type="radio" name="q5" id="q5a4">Multiple choice4 <button type="Button" onclick="checkfornull()">Generate score</button> </form> Now as code reveals I've created 5 virtual fields and trying tofill them up with values user selected from radio buttons. document.getElementById("Virtual1").value=sel1; document.getElementById("Virtual2").value=sel2; document.getElementById("Virtual3").value=sel3; document.getElementById("Virtual4").value=sel4; document.getElementById("Virtual5").value=sel5; How ever this last part of the script but everything works. Please help me in accomplishing this task. How do I put values of my custom radiobuttons into the virtual fields which are hidden. I plan to pass these values to another datapage where I validate the answers, give applicant a score and store it in applicant table. [/size] Quote Link to comment Share on other sites More sharing options...
0 Mallika Posted January 26, 2013 Author Report Share Posted January 26, 2013 Thanks William. But I thought of a work around. Instead of making 5 hidden virtual buttons, I'll make 5 virtual radio buttons with my test details . That way I need not worry about passing databack. New to Caspio so fiddling with stuff still. Quote Link to comment Share on other sites More sharing options...
0 Alans123 Posted January 28, 2013 Report Share Posted January 28, 2013 you most welcome Malika and give me one kind of new program related to online test page.. Quote Link to comment Share on other sites More sharing options...
Question
Mallika
Hi There,
I need to create an online test Datapage to access the subject expertise of the applicants who wish to register with our website to teach.
For this I have created a Custom HTML Page with following code
Now as code reveals I've created 5 virtual fields and trying tofill them up with values user selected from radio buttons.
How ever this last part of the script but everything works.
Please help me in accomplishing this task.
How do I put values of my custom radiobuttons into the virtual fields which are hidden.
I plan to pass these values to another datapage where I
validate the answers, give applicant a score and store it in applicant table.
[/size]
Link to comment
Share on other sites
2 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.