Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 02-27-2007, 11:27 AM   PM User | #1
alexander_c
New to the CF scene

 
Join Date: Feb 2007
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
alexander_c is an unknown quantity at this point
Question How do I make a text field active on selection of a menu item?

Can I use 'onclick' to activate a text field in the same form when user selects a particular item from a dropdown menu?

Thanks in advance,

Claire
alexander_c is offline   Reply With Quote
Old 02-27-2007, 01:51 PM   PM User | #2
mauzzzie
New Coder

 
Join Date: Dec 2006
Posts: 30
Thanks: 0
Thanked 0 Times in 0 Posts
mauzzzie is an unknown quantity at this point
What exactly are you trying to do? Can you be more specific please? Maybe an example?
mauzzzie is offline   Reply With Quote
Old 02-27-2007, 02:19 PM   PM User | #3
alexander_c
New to the CF scene

 
Join Date: Feb 2007
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
alexander_c is an unknown quantity at this point
Hi there

I am trying to get the last option on my dropdown menu ('Other') to display the textfield 'chosencountry' by using 'onClick'

<select name="country" id="country">
<option value="" Option 1</option>
<option value="" Option 2</option>
<option value="" onClick="">Other</option>
</select>
<br>
<input type= "text" name="chosencountry" style="visibility:hidden">

Thanks in advance

Claire
alexander_c is offline   Reply With Quote
Old 02-27-2007, 02:43 PM   PM User | #4
mauzzzie
New Coder

 
Join Date: Dec 2006
Posts: 30
Thanks: 0
Thanked 0 Times in 0 Posts
mauzzzie is an unknown quantity at this point
Internet Explorer

I think this is what you are looking for:

Code:
<SCRIPT>
function checkIt(value){
	if (value == "Other"){
		document.getElementById("field").style.display = "";
	}
}
</SCRIPT>
<SELECT name="country" id="country" onchange="checkIt(this.value);">
  <OPTION value="">Option 1</OPTION>
  <OPTION value="">Option 2</OPTION>
  <OPTION value="Other">Other</OPTION>
</SELECT>
<BR>
<INPUT id="field" type="text" name="chosencountry" style="display:none;">
greetz
mauzzzie is offline   Reply With Quote
Old 02-27-2007, 03:39 PM   PM User | #5
alexander_c
New to the CF scene

 
Join Date: Feb 2007
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
alexander_c is an unknown quantity at this point
Thanks a million.
That's exactly what I wanted!

I appreciate your time,

Claire
alexander_c is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 06:01 AM.


Advertisement
Log in to turn off these ads.