Click here to Skip to main content
16,018,904 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hello!
I have a basic form setup in an html file. What I want to do is if a user selects a specific option in a dropdown box, then display an additional field on the page. Is this possible?

Thanks!
Ross
Posted
Comments
Uday P.Singh 12-Jun-11 12:19pm    
are you talking about select box or combo box getting confused with dropdown box??

1 solution

Yes, very much possible.

For example, if you select 'Others' as an option in the select then a textbox needs to be shown where one can fill any description of other if needed.

You need to do:
1. Attach a Javascript 'onchange' handler for the select
2. Whenever anything is selected the 'onchange' will be triggered and you can check the selected value
3. If the selected value is the one that needs some extra steps then do it or else skip rest.
4. If it is the specific step, then via Javascript, access the other control (like a textbox), set its display property as true such that one can add more details.

Done! Try!
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 12-Jun-11 16:06pm    
Absolutely, a 5.
--SA
Sandeep Mewara 13-Jun-11 1:49am    
Thanks SA.
Tarun Mangukiya 13-Jun-11 1:43am    
Ya You are right.
RakeshMeena 13-Jun-11 6:08am    
My 5!
Sandeep Mewara 13-Jun-11 6:15am    
Thanks Rakesh.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900