473,657 Members | 2,427 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

change drop down box values on the fly

I have 2 drop down boxes. When the user changes the values in one drop
down box,
the values in another drop down box will be changed on the fly.

Is it possible to do that? in client side or server side? what's the
best approach to
this problem?

please help. thanks!!
Jul 23 '05 #1
9 3658
On 2 Dec 2004 11:02:59 -0800, Matt <jr********@hot mail.com> wrote:
I have 2 drop down boxes. When the user changes the values in one drop
down box,
the values in another drop down box will be changed on the fly.
Is it possible to do that? in client side or server side? "on the fly" by itself implies client side, i.e. JavaScript.
what's the
best approach to this problem?

server side processing, i.e. your favorite scripting language. Otherwise,
the site won't work for people with JS disabled or unavailable.
--
Mitja
Jul 23 '05 #2
On 2 Dec 2004 11:02:59 -0800, Matt <jr********@hot mail.com> wrote:
I have 2 drop down boxes. When the user changes the values in one drop
down box, the values in another drop down box will be changed on the fly.

Is it possible to do that? in client side or server side? what's the
best approach to this problem?


Yes, it is possible to do it both client-side and server-side. The best
approach is to actually use both: attempt to do it on the client first and
if that fails, fall back to the server. It's a little more work for you,
but it provides both a quick and robust interface. If the script is kept
in an external file (and it should), it should also reduce the total
traffic as unscriptable user agents won't download unnecessary data.

A generic client-side solution would be too bloated, so if you want a
demonstration, it would be best to provide more information, preferably
showing the page that will contain this feature.

If you don't have the necessary server-side support (so only a client-side
solution is possible), Richard Cornford provides a possible answer:
<URL:http://www.litotes.dem on.co.uk/example_scripts/dependent_selec t.html>.

Mike

--
Michael Winter
Replace ".invalid" with ".uk" to reply by e-mail.
Jul 23 '05 #3
On Thu, 02 Dec 2004 20:13:18 GMT, Michael Winter wrote:
...The best
approach is to actually use both: attempt to do it on the client first and
if that fails, fall back to the server.


What's the point of that? If you have server-side includes I cannot
see the sense of attempting it client-side.

F'Ups not set, but please consider doing so in future cross-posts.

--
Andrew Thompson
http://www.PhySci.org/codes/ Web & IT Help
http://www.PhySci.org/ Open-source software suite
http://www.1point1C.org/ Science & Technology
http://www.LensEscapes.com/ Images that escape the mundane
Jul 23 '05 #4
On Thu, 02 Dec 2004 20:25:29 GMT, Andrew Thompson wrote:
F'Ups not set, but please consider doing so in future cross-posts.


BTW - that message was to the OP. Apologies for any confusion.

--
Andrew Thompson
http://www.PhySci.org/codes/ Web & IT Help
http://www.PhySci.org/ Open-source software suite
http://www.1point1C.org/ Science & Technology
http://www.LensEscapes.com/ Images that escape the mundane
Jul 23 '05 #5
On Thu, 02 Dec 2004 20:25:29 GMT, Andrew Thompson <Se********@www .invalid>
wrote:
On Thu, 02 Dec 2004 20:13:18 GMT, Michael Winter wrote:
...The best approach is to actually use both: attempt to do it on the
client first and if that fails, fall back to the server.
What's the point of that? If you have server-side includes I cannot see
the sense of attempting it client-side.


It's quicker for the user, basically. It also has the potential to reduce
the number of requests made to the server.

Based on your argument, why bother validating forms on the client when you
can just wait for the server to throw back a message saying the user made
a mistake?
F'Ups not set, but please consider doing so in future cross-posts.


The post is valid in both groups, particularly as the discussion goes
beyond just Javascript.

Mike

--
Michael Winter
Replace ".invalid" with ".uk" to reply by e-mail.
Jul 23 '05 #6
On Thu, 02 Dec 2004 20:40:49 GMT, Michael Winter wrote:
On Thu, 02 Dec 2004 20:25:29 GMT, Andrew Thompson <Se********@www .invalid>
wrote:

....
F'Ups not set, but please consider doing so in future cross-posts.


The post is valid in both groups, particularly as the discussion goes
beyond just Javascript.


(Head of legal team) What Mr. Thompson *meant* to say there was
'Please set follow-ups once the most appropriate group becomes
clear, assuming the there *is* a most appropriate group. Thank you
for attending, that concludes the press conference. No autographs
will be signed at this time.'

(General hub-bub as legal team hussles Mr. Thompson from press conference)

--
Andrew Thompson
http://www.PhySci.org/codes/ Web & IT Help
http://www.PhySci.org/ Open-source software suite
http://www.1point1C.org/ Science & Technology
http://www.LensEscapes.com/ Images that escape the mundane
Jul 23 '05 #7
Michael Winter wrote:
A generic client-side solution would be too bloated...


I disagree [of course ;)]
http://www.javascripttoolbox.com/dynamicoptionlist/

Certainly more kb than a custom solution, but a) that may not matter and b)
it could save considerable development and debugging time and allow the OP
to achieve something they might otherwise lack the skill to implement.

--
Matt Kruse
http://www.JavascriptToolbox.com
Jul 23 '05 #8
On Thu, 2 Dec 2004 22:36:22 -0600, Matt Kruse <ne********@mat tkruse.com>
wrote:
Michael Winter wrote:
A generic client-side solution would be too bloated...


I disagree [of course ;)]
http://www.javascripttoolbox.com/dynamicoptionlist/


I don't remember what precisely your code did, but as I was thinking about
writing a demo, I realised that it would be pretty much useless unless I
happened to do things exactly the way the OP would. Eventually, I came to
a conclusion: I couldn't be arsed. :D

[snip]

Mike

--
Michael Winter
Replace ".invalid" with ".uk" to reply by e-mail.
Jul 23 '05 #9
thank you so much for the suggestions.

If i do in client-side, then I use JavaScript event and <div> tag?

If i do in server-side, then I will post the same page to server?

please advise more. thanks!!
Jul 23 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
2458
by: PT | last post by:
I got a form with many text boxes, checkboxes and 3 drop downs. From that 3, 2 are dependant. I can choose one drop down, and the next drop down should display the dependant values of the first drop down chosed. And I have a submite button to submit all these values to DB. First problem: I cant keep the value of the selected text in the first drop down. It always goes back to the first value. (but the asp site extension changes...
4
6296
by: Dan | last post by:
Can anyone offer suggestions on how to do this or if it is possible? I have a form that uses a drop down box and 2 text fields. What I am trying to do is have the value of each text box set by the choice from the drop down box. Something like: <form name="populatefrm" id="contactfrm" method="post"
3
14216
by: Miguel Dias Moura | last post by:
Hello, i have an ASP.NET / VB page where i have a few 4 groups of Drop Down Lists. Each group of Drop Down Lists include 3 Drop Down Lists for date such as: DAY, MONTH, and YEAR. I don't want to insert the values and text to each drop down list. So i want to create a script that populates a certain Drop Down List with certain values when page loads such as:
5
4219
by: Vigneshwar Pilli via DotNetMonster.com | last post by:
string connectionString1 = "server=(local); user=sa;password=sa; database=sonic"; System.Data.SqlClient.SqlConnection dbConnection1 = new System.Data.SqlClient.SqlConnection(connectionString1); System.Data.SqlClient.SqlCommand dbCommand1 = new System.Data.SqlClient.SqlCommand();
6
2237
by: John | last post by:
I have a drop down on my form and I need all the values in that drop down and pass to a stored procedure, how can I get the values of the drop down and pass them all to my stored procedure call?
2
12425
by: Eric Layman | last post by:
Hi, I have a radio button and a combo box. Upon changing a value for radio button, the combo box values will be dynamically updated. I have an idea on how to go abt doing it but Im stuck into converting into code.
1
3044
by: azeemqaiser | last post by:
Hi All, I have a form with two drop down controls. I want to change the values of Drop Down Menu 2 if i select some value in Drop Down Menu 1. Like If i select country then all the states of this country should get populated in the second menu. Will appreciate your help.
3
3565
by: printline | last post by:
Hello All I need some help in a form i'm creating. I have to fields with drop down select boxes. What i want to do is, when a user selects a given value in one drop down, the other drop down should atumatically change to another value. Ex: the user choses the number "4" in one box, then the other box should change to "4 WD". Here is my code: <select name="job___num_layers"...
3
1759
by: phpmagesh | last post by:
Hi, I have a drop down in my page, what i will do with that drop down is i have a table in my database, which have values and this table will refer that ID and pick the name of that values and display in the drop down box. my table have ID, name, quantity, stock and date created. now what i want to do is when the stock is <=0 the drop down should add sold out in front of the attributes. Ex:
0
8402
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
8829
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8734
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
8508
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
8608
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...
1
6172
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5633
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4323
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2733
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

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.