Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > HTML > change drop down box values on the fly

Reply
Thread Tools

change drop down box values on the fly

 
 
Matt
Guest
Posts: n/a
 
      12-02-2004
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!!
 
Reply With Quote
 
 
 
 
Mitja
Guest
Posts: n/a
 
      12-02-2004
On 2 Dec 2004 11:02:59 -0800, Matt <(E-Mail Removed)> 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
 
Reply With Quote
 
 
 
 
Michael Winter
Guest
Posts: n/a
 
      12-02-2004
On 2 Dec 2004 11:02:59 -0800, Matt <(E-Mail Removed)> 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.demon.co.uk/example_scripts/dependent_select.html>.

Mike

--
Michael Winter
Replace ".invalid" with ".uk" to reply by e-mail.
 
Reply With Quote
 
Andrew Thompson
Guest
Posts: n/a
 
      12-02-2004
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
 
Reply With Quote
 
Andrew Thompson
Guest
Posts: n/a
 
      12-02-2004
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
 
Reply With Quote
 
Michael Winter
Guest
Posts: n/a
 
      12-02-2004
On Thu, 02 Dec 2004 20:25:29 GMT, Andrew Thompson <(E-Mail Removed)>
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.
 
Reply With Quote
 
Andrew Thompson
Guest
Posts: n/a
 
      12-03-2004
On Thu, 02 Dec 2004 20:40:49 GMT, Michael Winter wrote:

> On Thu, 02 Dec 2004 20:25:29 GMT, Andrew Thompson <(E-Mail Removed)>
> 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
 
Reply With Quote
 
Matt Kruse
Guest
Posts: n/a
 
      12-03-2004
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


 
Reply With Quote
 
Michael Winter
Guest
Posts: n/a
 
      12-03-2004
On Thu, 2 Dec 2004 22:36:22 -0600, Matt Kruse <(E-Mail Removed)>
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.

[snip]

Mike

--
Michael Winter
Replace ".invalid" with ".uk" to reply by e-mail.
 
Reply With Quote
 
Matt
Guest
Posts: n/a
 
      12-03-2004
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!!
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Affecting a dynamically created drop down from another dynamically created drop down. msimmons ASP .Net 0 07-16-2009 03:17 PM
retrive preselected value in second drop down list from the first drop down list weiwei ASP .Net 0 01-05-2007 07:29 PM
Creating drop down selection box on the fly szabgab@gmail.com Javascript 2 03-10-2005 07:55 PM
New to .NET, can I have one drop down box control the data of another drop down box using a database? SirPoonga ASP .Net 2 01-07-2005 10:44 PM
change drop down box values on the fly Matt Javascript 6 12-03-2004 03:40 PM



Advertisments