JavaScript Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingJavaScript Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old June 16th, 2005, 02:18 PM
SABmore SABmore is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jun 2002
Posts: 17 SABmore User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 11 m 34 sec
Reputation Power: 0
Populate Input Box from Listbox?

Can anyone demonstrate or point me in the right direction as to how to populate a single input box, with a single selection from a listbox?

I can't seem to find any examples of this.

Thanks in advance for your help.

Reply With Quote
  #2  
Old June 17th, 2005, 09:13 AM
MadCowDzz's Avatar
MadCowDzz MadCowDzz is offline
I'm Internet Famous
Dev Articles Frequenter (2500 - 2999 posts)
 
Join Date: Jan 2003
Location: Toronto, Canada
Posts: 2,890 MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level)MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level)MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 1 Week 16 h 14 m 9 sec
Reputation Power: 8
How about something like this?

Code:
<html>
<head>
<title>Test Page</title>
</head>

<body>
<h1>Test Page</h1>
<form>
	<select onchange="document.getElementById('txtInput').value=this.opt  ions[this.selectedIndex].value;">
		<option>Hello</option>
		<option>World</option>
	</select>

	<input id="txtInput" type="text">

	<input type="submit" value="Go">

</form>
</body>
</html>

Reply With Quote
  #3  
Old December 4th, 2007, 07:22 PM
jacket jacket is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Dec 2007
Posts: 1 jacket User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 18 m 55 sec
Reputation Power: 0
Working example of populated input field

Thanks MadCowDzz,

I used this code to display the country code for a telephone number. The user selects their country and then this populates a disabled text field with the country code value.

This is the code for the populated field:

Code:
<input type="text" id="ccode" name="telephone_code" class="shortfield" size="3" disabled />


And this is the code for the select menu that populates the field:

Code:
<select id="country" name="country" class="text" onchange="document.getElementById('ccode').value=this.option  s[this.selectedIndex].value;">


You can see the select and input working here:

http://www.kualalumpurcondo.com/enquiry

This is a good way to get the full country code when you are dealing with enquiries from all over the world.

Reply With Quote
  #4  
Old January 30th, 2008, 02:15 PM
ehsan's Avatar
ehsan ehsan is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2006
Location: North York, ON, Canada
Posts: 60 ehsan User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 18 h 45 m
Reputation Power: 3
Send a message via MSN to ehsan Send a message via Yahoo to ehsan Send a message via Google Talk to ehsan Send a message via Skype to ehsan
You may want to look at this example:

http://ehsan.bdwebwork.com/blog?a=d&b=48&s=8

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingJavaScript Development > Populate Input Box from Listbox?


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway
Stay green...Green IT