473,671 Members | 2,287 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

javascript for dependent dropdowns

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

<html>
<head>
<script type="text/javascript" language="javas cript">
function setOptions(chos en) {
var selbox = document.kickof f.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="setOp tions(document. kickoff.system. options[document.kickof f.system.select edIndex].value);">
<option value="SOD">SOD </option>
<option value="AQ">Auto Quote</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=NothAmeric a.
Similarly,
Value=US
text=UnitedStat es
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 2461
r035198x
13,262 MVP
I have one javascript code with me,to show parent dropdown as well as child dropdown.

<html>
<head>
<script type="text/javascript" language="javas cript">
function setOptions(chos en) {
var selbox = document.kickof f.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="setOp tions(document. kickoff.system. options[document.kickof f.system.select edIndex].value);">
<option value="SOD">SOD </option>
<option value="AQ">Auto Quote</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=NothAmeric a.
Similarly,
Value=US
text=UnitedStat es
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 New Member
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
9428
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 intercept the key so that I can do stuff on the server side to make the new window behave correctly? (We have a JSP-based webapp which stores state in the session. Now if two windows access (and modify!) the same session, then madness will result....
19
2094
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 like this? -- "I hear ma train a comin' .... hear freedom comin"
1
1397
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, it gives all States of that Country in an another Dropdown called States. For Example if I selected my country as England, it gives all the states in England in the States Dropdown. In this regard, State is dependent on the Country Selected from...
5
2314
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 way I can get all my data from a dataset\datareader into some javascript arrays and then use client side events to handle the inter-dependent dropdowns? Any code examples? I know in ASP.Net 2.0 there is a feature called "Client Callback" which...
1
1188
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, and I used input form for that... Now in asp.net 2.0 I can't use input forms because I could not get the information that I need from thay using the framework (in this case using
1
1276
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 issue is? Here is the url: http://67.62.217.33/test5 You will need to supply a valid zip, as it does a check for areas the insurance is available. You can use 23834 The issue I'm having is on the the next page there, intro-page2.asp, if you...
5
3652
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 can I connect to the database on the server after the first two dropdowns have been selected by the user in order to be able to set up the third dropdown? The first dropdown is states (8 in number for my application). The second is counties...
1
1656
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 database table 2.state database table 3.pincode database table So for the above tables i need dependent drop down
0
1611
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 viewed: www.faith.org.uk/Testindex.html In IE7 it works fine. The video shows and the dropdowns of the menu work correctly. In Mozilla Firefox, although the video works the dropdowns do not show. I have been told that everything works ok in OS...
0
8476
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8393
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8821
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8598
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8670
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7437
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4407
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2812
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1809
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.