473,402 Members | 2,046 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,402 software developers and data experts.

javascript for dependent dropdowns

I have one javascript code with me,to show parent dropdown as well as child dropdown.

<html>
<head>
<script type="text/javascript" language="javascript">
function setOptions(chosen) {
var selbox = document.kickoff.regionId;
selbox.options.length = 0;
if (chosen == "SOD") {
selbox.options[selbox.options.length] = new Option('EMEA');
selbox.options[selbox.options.length] = new Option('NA');
}
if (chosen == "AQ") {
selbox.options[selbox.options.length] = new Option('US');
selbox.options[selbox.options.length] = new Option('AU');
}
}
</script>
</head>

<body>
<form action="/.drop" name="kickoff" method="post">
<table border="0" cellpadding="1" cellspacing="3">
<tr>
<td>
<select name="system" onchange="setOptions(document.kickoff.system.optio ns[document.kickoff.system.selectedIndex].value);">
<option value="SOD">SOD</option>
<option value="AQ">AutoQuote</option>
</select>

</td>
</tr>
<tr>

<th>
Region Code
</th>
<td>
<select name="regionId" >
<option value="EMEA" >Emiratres</option>
<option value="NA" >NorthAmerica</option>
</select>
</td>

</tr>
<span class="button-blue">
<input type="submit" >
</span>
</form>
</body>
</html>
---------------------------------------*********************---------------------------------------------------My question is: how to get texts in dropdown list just by passing only value of the options....I mean,per suppose,NA means NorthAmerica..
Value=NA
text=NothAmerica.
Similarly,
Value=US
text=UnitedStates
Value=AU
text=Australia.
If parent drop down value=SOD and text =SOD then
child dropdown should have Emiratres ,NorthAmerica as contents in dropdown list;
If parent drop down value=AQ and text =AutoQuote then
child dropdown should have UnitedStates ,Australia as contents in dropdown list
Jun 27 '07 #1
2 2442
r035198x
13,262 8TB
I have one javascript code with me,to show parent dropdown as well as child dropdown.

<html>
<head>
<script type="text/javascript" language="javascript">
function setOptions(chosen) {
var selbox = document.kickoff.regionId;
selbox.options.length = 0;
if (chosen == "SOD") {
selbox.options[selbox.options.length] = new Option('EMEA');
selbox.options[selbox.options.length] = new Option('NA');
}
if (chosen == "AQ") {
selbox.options[selbox.options.length] = new Option('US');
selbox.options[selbox.options.length] = new Option('AU');
}
}
</script>
</head>

<body>
<form action="/.drop" name="kickoff" method="post">
<table border="0" cellpadding="1" cellspacing="3">
<tr>
<td>
<select name="system" onchange="setOptions(document.kickoff.system.optio ns[document.kickoff.system.selectedIndex].value);">
<option value="SOD">SOD</option>
<option value="AQ">AutoQuote</option>
</select>

</td>
</tr>
<tr>

<th>
Region Code
</th>
<td>
<select name="regionId" >
<option value="EMEA" >Emiratres</option>
<option value="NA" >NorthAmerica</option>
</select>
</td>

</tr>
<span class="button-blue">
<input type="submit" >
</span>
</form>
</body>
</html>
---------------------------------------*********************---------------------------------------------------My question is: how to get texts in dropdown list just by passing only value of the options....I mean,per suppose,NA means NorthAmerica..
Value=NA
text=NothAmerica.
Similarly,
Value=US
text=UnitedStates
Value=AU
text=Australia.
If parent drop down value=SOD and text =SOD then
child dropdown should have Emiratres ,NorthAmerica as contents in dropdown list;
If parent drop down value=AQ and text =AutoQuote then
child dropdown should have UnitedStates ,Australia as contents in dropdown list
Moved to Java forum.
Jun 27 '07 #2
Logician
210 100+
I have one javascript code with me,to show parent dropdown as well as child dropdown.
Sounds like a job for SelectCascade.
Jun 27 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

13
by: Kai Grossjohann | last post by:
It seems that Ctrl-N in Mozilla opens a new empty browser window. That's fine, I don't need to do anything about it. But Ctrl-N in IE appears to clone the current window. Is there a way to...
19
by: Stimp | last post by:
preferably one that when clicked can update three date dropdowns (day, month, year) like http://www.visitdublin.com/carhire/avis.asp Don't mind paying for the file... anyone seen something...
1
by: Hifni Shahzard | last post by:
Hi, I'm using VS.NET 2003, SQL Server 2000, Windows xp professional; My Question: Some of you might seen in some websites where it requests the Country in a dropdown. If the Country selected,...
5
by: NH | last post by:
Hi, I am trying to minimise postback in my web app. I have a number of inter-dependent dropdowns, an onselectedindexchange event fires for each one which obviously causes a postback. Is there a...
1
by: Bruno Alexandre | last post by:
Hi guys... I'm always help the comunity, but this time it is me that need help :-( in the old Classic ASP I usted to have javascript to for example populate a 2nd dropdown from a 1st one,...
1
by: dirt29 | last post by:
I'm builiding an online insurance application, where people input thier data, and it gives them rates, then lets them apply. I was wondering if someone could take a look and maybe tell me what the...
5
by: Navodit | last post by:
I have 3 dropdowns in my application. Based on the selections made in the first two dropdowns, I need to pull out data from the database to set up the corresponding menu for the third dropdown. How...
1
by: sbettadpur | last post by:
Hi, Iam completely new to ajax, I have a task which is 3 dependent dropdowns which are generates automatically from three deferent databases tables based on one another table. example 1.country...
0
by: bogorman | last post by:
Am trying to add a "video" to a webpage which is based on a template containing a javascript menu. The site has hundreds of pages all based on this template and the menu works fine The page can be...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.