Jump to content

Based on radio button selection, drop down list


NathanLedet

Recommended Posts

I have a simple form I want users to fill out on my page.

 

If Option A is selected, nothing happens and all is well with the value that's there.

 

If Option B is selected, I would like for an additional drop down menu to appear below it with selectable options. 

 

How can I achieve this? Thank you for your help!

Link to comment
Share on other sites

This is more of just javascript showing and hiding elements.

 

I used dreamweaver for this one just as a quick example, the js is a little extreme but it works.

 

<script type="text/javascript">
<!--
function MM_showHideLayers() { //v9.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) 
  with (document) if (getElementById && ((obj=getElementById(args[i]))!=null)) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}
//-->
</script>

 

 

<body onload="MM_showHideLayers('drop','','hide')">
<form action="" method="get">
  <p>
    <label>
    <input type="radio" name="RadioGroup1" value="radio" id="RadioGroup1_0" />
      Radio</label>
    <br />
    <label>
    <input type="radio" name="RadioGroup1" value="radio" id="RadioGroup1_1" onclick="MM_showHideLayers('drop','','show')" />
      Radio</label>
    <br />
  </p>
<select name="select" id="drop">
  <option value="asdas">asad</option>
  <option value="sadasdsad">asdasd</option>
</select>
</form>
</body>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.