Dynamic Drop Down Menu
Moderator: General Moderators
Dynamic Drop Down Menu
hey guys,
hear this situation
A drop down menu with these option:
1) Paedriatic
2) Orthopaedic
3) ICU
4) Others
is there any code that once the user choose "Others", a new blank field will appear for the user to key in the value at that very moment.
Similar like when a user choose an option on the drop down menu, the option will lead directy to other page. But what im trying to do is when a user choose the last option, the new blank input is appear for user to key in the "Other" field value.
i guess it involves javascript isnt it?
does anyone care to share?
thanks
azhan
hear this situation
A drop down menu with these option:
1) Paedriatic
2) Orthopaedic
3) ICU
4) Others
is there any code that once the user choose "Others", a new blank field will appear for the user to key in the value at that very moment.
Similar like when a user choose an option on the drop down menu, the option will lead directy to other page. But what im trying to do is when a user choose the last option, the new blank input is appear for user to key in the "Other" field value.
i guess it involves javascript isnt it?
does anyone care to share?
thanks
azhan
Re: Dynamic Drop Down Menu
Give it a try using google and then I can help you tuning the code.
-
mattpointblank
- Forum Contributor
- Posts: 304
- Joined: Tue Dec 23, 2008 6:29 am
Re: Dynamic Drop Down Menu
Hi, I have a slightly different issue
I created a dynamic drop down box that extract values from a column in a mysql database. But I want a first drop down that has all 26 letters of the alphabet, based on the result of the first drop down, the dynamic drop down should be populated.
For the first drop down, I created a non dynamic drop down but not sure how to code so that the result is used to populate the dynamic drop down...
I created a dynamic drop down box that extract values from a column in a mysql database. But I want a first drop down that has all 26 letters of the alphabet, based on the result of the first drop down, the dynamic drop down should be populated.
For the first drop down, I created a non dynamic drop down but not sure how to code so that the result is used to populate the dynamic drop down...
- Skoalbasher
- Forum Contributor
- Posts: 147
- Joined: Thu Feb 07, 2008 8:09 pm
Re: Dynamic Drop Down Menu
AJAX. Read up on AJAX and dynamic dropdown. Mix of Javscript and PHP/ASP/whatever server side script...
Re: Dynamic Drop Down Menu
Are you kidding me....you made it sound very complicated! any guidance which chapters, I should read about ajax, javascript Texan??
- Skoalbasher
- Forum Contributor
- Posts: 147
- Joined: Thu Feb 07, 2008 8:09 pm
Re: Dynamic Drop Down Menu
Ok sorry, I actually read your post incorrectly. This is just Javascript and HTML. This really doesn't belong in this part of the forum I don't think, but here ya go.tat wrote:Are you kidding me....you made it sound very complicated! any guidance which chapters, I should read about ajax, javascript Texan??
Add this to the top of your page, in between the <HEAD></HEAD> tags.
Code: Select all
<SCRIPT LANGUAGE="JavaScript">
document.getElementById("oth").visibility='hidden';
function doWork(idnum){
// check to see if user selected the 4th option
if(idnum == 4){
document.getElementById("oth").visibility='visible';
}
else {
document.getElementById("oth").visibility='hidden';
// uncomment the line below to clear the "other" textbox if another option is checked
//document.getElementById("other").value = "";
}
}
</script>
Code: Select all
<select name="medstuff" id="medstuff" onchange="doWork(this.value)"> <!--this calls javascript function-->
<option value="1">Paedriatic</option>
<option value="2">Orthopaedic</option>
<option value="3">ICU</option>
<option value="4">Others</option>
</select>
<!--------------- Add this to where you want your text box to come up------->
<div id="oth">
<input type="text" name="other" id="other" value="">
</div>
-
bigbstanley
- Forum Newbie
- Posts: 4
- Joined: Sat Mar 04, 2006 11:48 am
- Location: Fort Lauderdale, FL
Re: Dynamic Drop Down Menu
definitely javascript on that one. Look up a hide/show function or check out jQuery - tons of examples of common javascript for you to play with and implement into your dropdown.