Click to See Complete Forum and Search --> : Form in a form?


BrainDonor
05-12-2003, 08:39 PM
Hello all,
I am wondering if it's possible to have radio buttons drive what shows up in a drop down list? Or, when the radio button is selected a drop down list specific to that button appears immediately to the right of the radio button. Any ideas? Thoughts?

Thanks for your time.

Tom

PeOfEo
05-12-2003, 09:19 PM
well sorta... but its not just going to go boom and appear like an image roll over or something. It will cause the page to reload.

BrainDonor
05-12-2003, 09:26 PM
It's okay if that page reloads. I found a similar post...so I think...

I'd like to do something like this with numerous options, but with a drop down list instead of a text box.

<html>
<head>
<title>Checkbox Demo</title>

<script language="javascript" type="text/javascript">

function showhide(frm) {
if (frm.mycheckbox.checked == true) {
document.getElementById("mytext").style.visibility = "visible";
}
else {
document.getElementById("mytext").style.visibility = "hidden";
}
}

</script>
</head>

<body>
<form name="myform">
<input name="mycheckbox" type="checkbox" value="shown" onClick="showhide(this.form)" checked>
<input id="mytext" name="mytext" type="text">
</form>
</body>
</html>

Thanks again!

Tom

PeOfEo
05-12-2003, 09:29 PM
oh humm... it might not refresh with java script... So you just want something where you check the check box and then a combo apprears correct? I am not much of a java script scolar, I only use it when I absulutly need it and I dont like doing client side scripting of that nature very much because it tends to lag the site up for 56k users. But, if that script can do it, what is your question now?

BrainDonor
05-12-2003, 09:54 PM
Something like this...but I think this needs help becuase I only want the drop down to appear if the box is checked...which is why I'd rather use radio buttons...

<html>
<head>
<script language="javascript" type="text/javascript">

function showhide(frm) {
if (frm.mycheckbox.checked == true) {
document.getElementById("myjumpbox").style.visibility = "visible";
}
else {
document.getElementById("myjumpbox").style.visibility = "hidden";
}
}

</script>
<script language="javascript" type="text/javascript">
function showhide2(frm2) {
if (frm2.mycheckbox2.checked == true) {
document.getElementById("myjumpbox2").style.visibility = "visible";
}
else {
document.getElementById("myjumpbox2").style.visibility = "hidden";
}
}

</script>
</head>

<body>
<form name="myform">
<input name="mycheckbox" type="checkbox" value="shown" onClick="showhide(this.form)"

checked>Office<form name="jump">
<select name="myjumpbox"
OnChange="window.open(jump.myjumpbox.options[selectedIndex].value)">
<option selected>Please Select...
<option value="http://www.davesite.com/">davesite.com
<option value="http://www.neonlollipops.com/">neonlollipops.com
<option value="http://www.about.com/">about.com
</select>
</form>
</form>

<form name="myform2">
<input name="mycheckbox2" type="checkbox" value="shown" onClick="showhide2(this.form)">Dept

<form name="jump2">
<select name="myjumpbox2"
OnChange="window.open(jump2.myjumpbox2.options[selectedIndex].value)">
<option selected>Please Select...
<option value="http://www.davesite.com/">davesite.com
<option value="http://www.neonlollipops.com/">neonlollipops.com
<option value="http://www.about.com/">about.com
</select>
</form>
</form>
</body>
</html>

khalidali63
05-12-2003, 10:09 PM
are the values in the drop down box pre determined?

BrainDonor
05-12-2003, 10:11 PM
Yes.

khalidali63
05-12-2003, 10:13 PM
give me few mins..:D

BrainDonor
05-12-2003, 10:15 PM
Thank you thank you!!

khalidali63
05-12-2003, 11:18 PM
Check this link out..
http://68.145.35.86/skills/javascripts/DropdownListDisplayRadioSelection.html

BrainDonor
05-12-2003, 11:22 PM
Very cool! Thanks so much! Lots o'code! Wow!

But...very cool...just what I needed! Thanks again!

Tom

khalidali63
05-12-2003, 11:25 PM
you are welcome....

:D

BrainDonor
05-13-2003, 07:22 AM
One more question, if I may...

How do I get the page to open in a new window when a specific value is selected from any of the three lists. Say, for example, that I choose Canada from the list and when that happens, it opens in a new window and takes me to http://www.canada.com or when I choose U.S.A. it opens in a new window and takes me to http://www.usa.org, etc...you get the idea...

Thanks again, you've been a tremendous help!

Tom

bloke
05-13-2003, 09:43 AM
Use onChange() in the select box to activate the popup window:

<script language="javascript">
function openFile(jsVar)
{
window.open(jsVar, "File", "toolbars=no, scrollbars=yes, height=500, width=640, resizable=yes, left=50, top=50");
}
</script>


<select name="doodah" onChange="openFile(this.value);">
<option value="" selected>--Select--</option>
<option value="canada.asp">Canada</option>
</select>

BrainDonor
05-13-2003, 11:00 AM
Works great! Thanks again! I am really happy that I found this forum. You guys rock!

Tom

BrainDonor
05-30-2003, 11:44 AM
Khalid,

Is there a way to load these arrays in your example at http://68.145.35.86/skills/javascripts/DropdownListDisplayRadioSelection.html from a .txt file? If so, please share. :)

Thanks again for all your help!!

Tom