This is Interesting: Free Magazines for Graphics designers and webmasters  


Home > Archive > Dreamweaver > March 2005 > Disable/enable drop-down menu with radio button





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Disable/enable drop-down menu with radio button
TMonk252

2005-03-08, 4:17 am

I'm trying to enable or disable two drop-down menus (select1 & select2) by
clicking on one of three radio buttons in the same group. I only want the drop
down menus to be enabled if the radio button with the value of "hours" is
checked. I guess I really need to know how to identify the "hours" value radio
button in my second line of javascript code (below line starting with
"if(document.form1.(". The rest of the code on that line I believe is
incorrect. Is it even possible to identify a specific radio button within a
radio group to do this? Any help would be appreciated.
Thanks.

Here's my code:

<%@LANGUAGE="JAVASCRIPT" CODEPAGE="1252"%>

<script language="javascript"><!--
function codename1(){
if(document.form1.(RadioGroup1[value="hours"]).checked)
{
document.form1.select1.disabled=false;
}
else
{document.form1.select1.disabled=true;
}
}
//-->
</script>

<form name="form1" id="form1" method="post" action="">
<p>
<label></label>
<input name="RadioGroup1" onclick="codename1()" type="radio" value="hours"
/>
<select name="select1" disabled id="select1">
</select>
to
<select name="select2" disabled id="select2">
</select>
<br />
<input type="radio" name="RadioGroup1" value="closedallday" />
Closed
<input name="RadioGroup1" type="radio" value="openallday" />
Open 24-Hours </p>
</form>

Paul Whitham TMM

2005-03-08, 11:19 pm

Have a look in the forms section of www.javascriptsource.com as there are a
couple of scripts in there showing how this is done.

--
Regards

Paul Whitham
Macromedia Certified Professional for Dreamweaver MX2004
Valleybiz Internet Design
www.valleybiz.net

Team Macromedia Volunteer for Ultradev/Dreamweaver MX
www.macromedia.com/support/forums/team_macromedia

"TMonk252" <webforumsuser@macromedia.com> wrote in message
news:d0j805$h52$1@forums.macromedia.com...
> I'm trying to enable or disable two drop-down menus (select1 & select2)

by
> clicking on one of three radio buttons in the same group. I only want the

drop
> down menus to be enabled if the radio button with the value of "hours" is
> checked. I guess I really need to know how to identify the "hours" value

radio
> button in my second line of javascript code (below line starting with
> "if(document.form1.(". The rest of the code on that line I believe is
> incorrect. Is it even possible to identify a specific radio button within

a
> radio group to do this? Any help would be appreciated.
> Thanks.
>
> Here's my code:
>
> <%@LANGUAGE="JAVASCRIPT" CODEPAGE="1252"%>
>
> <script language="javascript"><!--
> function codename1(){
> if(document.form1.(RadioGroup1[value="hours"]).checked)
> {
> document.form1.select1.disabled=false;
> }
> else
> {document.form1.select1.disabled=true;
> }
> }
> //-->
> </script>
>
> <form name="form1" id="form1" method="post" action="">
> <p>
> <label></label>
> <input name="RadioGroup1" onclick="codename1()" type="radio"

value="hours"
> />
> <select name="select1" disabled id="select1">
> </select>
> to
> <select name="select2" disabled id="select2">
> </select>
> <br />
> <input type="radio" name="RadioGroup1" value="closedallday" />
> Closed
> <input name="RadioGroup1" type="radio" value="openallday" />
> Open 24-Hours </p>
> </form>
>



Sponsored Links


Copyright 2003 - 2008 forum4designers.com  Software forum  Computer Hardware reviews