revolver_ocelot
07-08-2009, 09:22 AM
Hey Everyone
I have a page which is a simple questionnaire. Each question can only have one answer so I've used radio buttons. Before the user can proceed They must have selected one answer from each question. Can anyone show me how to validate all of the groups of radio buttons on the page?
Here's my basic code:
<html>
<head>
</head>
<body>
<div id="mainBody">
<h3>Physics Questions</h3><br />
<form action="" method="post" onsubmit="checkForm(this)">
<div id="questions">
Part 1 Questions<br /><br />
1: What does mass mean?<br />
<input type="radio" name="phyQ1" value="correct" />The amount of matter contained in an object<br />
<input type="radio" name="phyQ1" value="wrong" />The amount of water in an object<br />
<input type="radio" name="phyQ1" value="wrong" />The way gravity effects light<br />
<input type="radio" name="phyQ1" value="wrong" />The amount of light sent by the sun<br />
<br />
2: Where does gravity come from?<br />
<input type="radio" name="phyQ2" value="wrong" />The Ground<br />
<input type="radio" name="phyQ2" value="correct" />Gravitational pull is a force applied to an object as a result of another mass<br />
<input type="radio" name="phyQ2" value="wrong" />The way gravity effects light<br />
<input type="radio" name="phyQ2" value="wrong" />The amount of light sent by the sun<br />
<br />
</div>
<div align="right"><button type="button" id="nextButton" onclick="forward()">Next</button></div>
</form>
</div>
</body>
</html>
Thanks for any help you can give me
I have a page which is a simple questionnaire. Each question can only have one answer so I've used radio buttons. Before the user can proceed They must have selected one answer from each question. Can anyone show me how to validate all of the groups of radio buttons on the page?
Here's my basic code:
<html>
<head>
</head>
<body>
<div id="mainBody">
<h3>Physics Questions</h3><br />
<form action="" method="post" onsubmit="checkForm(this)">
<div id="questions">
Part 1 Questions<br /><br />
1: What does mass mean?<br />
<input type="radio" name="phyQ1" value="correct" />The amount of matter contained in an object<br />
<input type="radio" name="phyQ1" value="wrong" />The amount of water in an object<br />
<input type="radio" name="phyQ1" value="wrong" />The way gravity effects light<br />
<input type="radio" name="phyQ1" value="wrong" />The amount of light sent by the sun<br />
<br />
2: Where does gravity come from?<br />
<input type="radio" name="phyQ2" value="wrong" />The Ground<br />
<input type="radio" name="phyQ2" value="correct" />Gravitational pull is a force applied to an object as a result of another mass<br />
<input type="radio" name="phyQ2" value="wrong" />The way gravity effects light<br />
<input type="radio" name="phyQ2" value="wrong" />The amount of light sent by the sun<br />
<br />
</div>
<div align="right"><button type="button" id="nextButton" onclick="forward()">Next</button></div>
</form>
</div>
</body>
</html>
Thanks for any help you can give me