Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
Javascript How-To Ask your "How do I do this with Javascript?" questions here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old June 4th, 2003, 10:59 PM
Authorized User
 
Join Date: Jun 2003
Location: Quezon City, NCR, Philippines.
Posts: 26
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to vickriz
Default dynamic select item?

Good day to all.
how can i make a select item on[list] option form. end then at the next [input] box it will show the groupname of items where it belong.

ex.
municipality underProvince
Tondo CapitalRegion
Makati MetroManila
Manila CapitalRegion
Isabela Negros Occidental
Caloocan CapitalRegion
Pasay MetroManila
Alaminos Pangasinan
Alcala Pangasinan
...

listbox = municity and the inputbox = underProvince

any one can help me how to make a javascript for this prob???




Mabuhay!!!
__________________
Mabuhay!!!
  #2 (permalink)  
Old June 9th, 2003, 09:29 AM
Authorized User
 
Join Date: Jun 2003
Location: Lexington, KY, USA.
Posts: 46
Thanks: 0
Thanked 1 Time in 1 Post
Default

I will focus on how to get the select item's value into the input box.

If you need help setting up the select list, I will leave that to someone else.

<select id="place" onchange="lfNewItem(this)">
<option value="CapitalRegion">Tondo</option>
<option value="MetroManila">Makati</option>
...
</select>

<input type="text" id="groupname"/>
<script language="javascript">
<!--
function lfNewItem(pSel)
{
var lvgn=document.getElementById('groupname');
lvgn.value=this.value;
}
//-->
</script>

I think this will copy the selected item's value (the group-name) to the text box.


-Van
(Old dog learning new tricks...)
  #3 (permalink)  
Old June 10th, 2003, 08:32 AM
Authorized User
 
Join Date: Jun 2003
Location: Lexington, KY, USA.
Posts: 46
Thanks: 0
Thanked 1 Time in 1 Post
Default

Just need to correct something in the previous post...

function lfNewItem(pSel)
{
var lvgn=document.getElementById('groupname');
lvgn.value=pSel.value;
}


-Van
(Old dog learning new tricks...)
  #4 (permalink)  
Old June 11th, 2003, 09:47 PM
Authorized User
 
Join Date: Jun 2003
Location: Quezon City, NCR, Philippines.
Posts: 26
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to vickriz
Default

Thanks. the code really works...
More power!!:)

Mabuhay!!!


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I select an ITEM from a combobox? Ron Howerton VB.NET 2002/2003 Basics 18 October 2nd, 2015 09:18 PM
how to select an item from listview jthadathilm16 VB How-To 1 April 24th, 2006 11:33 AM
Dynamic Checkboxes using dynamic Select Values bsheridan Classic ASP Databases 0 March 12th, 2006 10:17 AM
Select an particular item when a listbox opens? alastair Access 2 December 29th, 2005 06:04 PM
dynamic select item? vickriz Javascript 1 June 5th, 2003 03:21 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.