Forum Moderators: open

Message Too Old, No Replies

Optional form

Opening a form, when an option is selected

         

FnTm

7:50 am on Jul 23, 2007 (gmt 0)

10+ Year Member



Hi!

I have a problem. I need a script, that would open a new input form, when a certain option is selected.

Example: In my Select an Answer I select Other and below the option select from, a new input field appears.

Is there a script or a command that does this?

Thanks,
FnTm

ahmedtheking

7:55 am on Jul 23, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Simplest way to do it is by using JavaScript:

<select name="something">
<option value="1">1</option>
<option value="2" onclick="Element.show('otheranswer')">2</option>
</select>
<div id="otheranswer" style="display:none"> Some more HTML here </div>

Of course, I've made use of the Prototype framework (http://www.prototypejs.org) but it's pretty simple to learn and easy to use! Hope this helps.