Minerva
12-01-2009, 11:33 AM
Hi Guys,
I'm fairly new to Javascript and would be grateful for any help you can give me. I've had a search on Google and found a couple of potential solutions but nothing seems to work quite right for what I need.
Basically I have a form with several questions followed by Yes/No radio buttons. Dependent on which answer is given, I want to display a different message above the text box.
For example, if you answered 'no' to a certain question then the message above the text box would change to say "Please fill in additional information" or something along those lines.
Below is the HTML to give you an idea of what I mean.
<table>
<tr>
<td> </td>
<td><label class="bold">Yes</label></td>
<td><label class="bold">No</label></td>
</tr>
<tr>
<td><label for="property_q1"> - Is this your house?</label></td>
<td><input name="property_q1" id="property_q1" type="radio" value="Yes" /></td>
<td><input name="property_q1" id="property_q1" type="radio" value="No" /></td>
</tr>
</table>
<br />
<div id="fine">It's fine, don't worry about filling it in.</div>
<div id="fill" style="display:none">Please fill in the form below.</div>
<table>
<tr>
<td> </td>
</tr>
<tr>
<td><textarea name="info" id="info" cols="60" rows="5"></textarea></td>
</tr>
</table>
<input type="submit" />
I'm fairly new to Javascript and would be grateful for any help you can give me. I've had a search on Google and found a couple of potential solutions but nothing seems to work quite right for what I need.
Basically I have a form with several questions followed by Yes/No radio buttons. Dependent on which answer is given, I want to display a different message above the text box.
For example, if you answered 'no' to a certain question then the message above the text box would change to say "Please fill in additional information" or something along those lines.
Below is the HTML to give you an idea of what I mean.
<table>
<tr>
<td> </td>
<td><label class="bold">Yes</label></td>
<td><label class="bold">No</label></td>
</tr>
<tr>
<td><label for="property_q1"> - Is this your house?</label></td>
<td><input name="property_q1" id="property_q1" type="radio" value="Yes" /></td>
<td><input name="property_q1" id="property_q1" type="radio" value="No" /></td>
</tr>
</table>
<br />
<div id="fine">It's fine, don't worry about filling it in.</div>
<div id="fill" style="display:none">Please fill in the form below.</div>
<table>
<tr>
<td> </td>
</tr>
<tr>
<td><textarea name="info" id="info" cols="60" rows="5"></textarea></td>
</tr>
</table>
<input type="submit" />