PDA

View Full Version : Help with Dynamic Test Box



FrankinLA
05-08-2009, 06:10 PM
I'm pretty much a complete novice when it comes to this.

I'm trying to create a one dynamic text field based on multiple selections from a previous drop-down menu. I'm using this function:


function toggleField2(val) {
var p = document.getElementById('No');
(val == 'No')? p.style.display = 'block' : p.style.display = 'none';
}

In this block of code:


<select class="text" name="answer_103" onChange="toggleField2(this.value);">
<option value="0">Please choose one...</option>
<option value="Easy">Yes, quite easily</option>
<option value="Yes">Yes</option>
<option value="Almost">Not exactly</option>
<option value="No">Not at all</option>
</select>
</td>
</tr>
<tr>
<td align="right" width="60%">
<input class="text" type="text" name="No" id="No" onfocus="this.value=''; this.onfocus=null" size="46" style="display: none;" value="Please tell us why...">
</td>
</tr>


This works great for displaying the additional field, when the user selects "No."

What I would like to do is have the additional field appear when the user selects either "Almost" OR 'No."

Any help would be hugely appreciated.