Forums

Need a Donation form with drop down list with "other" option

phil 10 Jun, 2010
Im trying to setup a form that has different donation amounts and when a user selects "Other" a field box appears and user can enter the amount.

I have a form started, but having trouble with it working correctly. I THINK I need some JavaScript to change the name of the select box from ssl_amount to something else and the name of the text box (the "other" field box) that appears to ssl_amount.

Can someone help?
phil 10 Jun, 2010
This is the code I'm using now.


<script type="text/javascript">
function toggleField(val) {
var o = document.getElementById('ssl_amount');
(parseInt(val) == 000)? o.style.display = 'block' : o.style.display = 'none';
}
</script>
<select name="ssl_amount" id="ssl_amount" onChange="toggleField(this.value);">
<option value="0" selected>Select Amount</option>
<option>2400.00</option>
<option>1000.00</option>
<option>500.00</option>
<option>250.00</option>
<option>100.00</option>
<option>50.00</option>
<option>1.00</option>
<option value="000">Other</option>
</select>
<input type="text" name="other" id="ssl_amount" style="display: none;">
</span></td>
This topic is locked and no more replies can be posted.