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!

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>

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.