Jump to content
  • 0

Online Test Datapage


Mallika

Question

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 to

fill 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]

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.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...