473,487 Members | 2,667 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Add drop down options after radio button click

I created a form using html, but am having trouble with one issue.

If I user clicks "no" on one of my radio buttons, I want a drop down
selection to appear next to it to display several "reasons" as to why
they chose "no".

How can I implement this?

Thanks in advance for the help!

Jun 13 '06 #1
3 2490
Jim
Here you go :
<body >
<form name="myform" action="" method="get">
Would You Buy Our Product?
<input type="radio" name="purchase" value="yes"
onClick="document.forms[0].elements['reasons'].style.display='none'"/>
Yes
<input type="radio" name="purchase" value="no"
onClick="document.forms[0].elements['reasons'].style.display='inline'"/>
No
<select name="reasons" style="display:none" >
<option value="" selected>Please Tell Us Why You Answered 'No'</option>
<option value="not interested">Not Interested</option>
<option value="haveonealready">Have one Already</option>
<option value="tooexpensive">Too Expensive</option>
</select>
<br/><br/>
<input type="submit" value="Submit"/>
<input type="reset" value="Reset"/>
</form>
</body>

Jun 14 '06 #2
That is exactly what I was looking for.

Thanks a ton!



Jim wrote:
Here you go :
<body >
<form name="myform" action="" method="get">
Would You Buy Our Product?
<input type="radio" name="purchase" value="yes"
onClick="document.forms[0].elements['reasons'].style.display='none'"/>
Yes
<input type="radio" name="purchase" value="no"
onClick="document.forms[0].elements['reasons'].style.display='inline'"/>
No
<select name="reasons" style="display:none" >
<option value="" selected>Please Tell Us Why You Answered 'No'</option>
<option value="not interested">Not Interested</option>
<option value="haveonealready">Have one Already</option>
<option value="tooexpensive">Too Expensive</option>
</select>
<br/><br/>
<input type="submit" value="Submit"/>
<input type="reset" value="Reset"/>
</form>
</body>


Jun 14 '06 #3
Jim wrote:
<input type="radio" name="purchase" value="yes"
onClick="document.forms[0].elements['reasons'].style.display='none'"/>


If there are any forms before that form, that script won't work.
Try "this.form" instead of "document.forms[0]"

Jun 14 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
23283
by: Darren | last post by:
Please Help Me!! I've created a typical <form> and a <select> element. The options are created dynamically from my access database (using asp). There are about 70 options, and when you click...
2
2443
by: tpaulson | last post by:
I have a couple of DIV's that I hide/display based on radio buttons. On the DIV's, I have multiple drop down boxes. The source shows that they are populated, but I can't make them drop down. Only...
11
2618
by: vinceboy | last post by:
Hi..guys!I have a drop down menu with javascript null validation.However,instead of clicking submit button,it will immediately auto redirect after option was selected.Is it possible to prevent this...
1
1878
by: bbcline | last post by:
Hi all, I'm a newbie to the forum and a Javascript beginner, I'd appreciate some help with a drop down box issue. Is it possble to limit the options/attributes in a drop down box based on how the...
11
9256
by: ajaymohank | last post by:
Hello Friends....... in my project i am having a dropdown and based on the values selected from the dropdown, i have to enable 2 radio button. in the on change function of drop down i have written...
0
6967
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7181
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7349
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5442
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4874
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4565
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3076
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1381
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
267
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.