[PEAR:QuickForm] Dynamically change a dropdown menu according to another menu?

This is a discussion on [PEAR:QuickForm] Dynamically change a dropdown menu according to another menu? within the PHP Language forums, part of the PHP Programming Forums category; Hello, I've been using QuickForm for a few months now and I am now given a new challenge: I'...


Go Back   Usenet Forums > PHP Programming Forums > PHP Language

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-28-2005
Jean-Fran?ois Lacrampe
 
Posts: n/a
Default [PEAR:QuickForm] Dynamically change a dropdown menu according to another menu?

Hello,

I've been using QuickForm for a few months now and I am now given a
new challenge:

I've got a search form with a dozen of dropdown menus, the first
dropdown menu being "Brand". If you select either Brand A, B, C, D...
Z, the second dropdown menu "Model" must be dynamically changed to
model AA, AB, AC, AD..., according to the models manufactured by the
brand selected in the first box.

I've seen that done on quite a few sites, but never found if QuickForm
had a quick & clean way of doing that.

Any idea?

Thanks,
JFLac
Reply With Quote
  #2 (permalink)  
Old 04-28-2005
micha
 
Posts: n/a
Default Re: Dynamically change a dropdown menu according to another menu?

i suppose "dynamically change" means on the spot...

using php - not possible, because to change the page you have to make a
trip to the server and back, i.e. reload the page.

if you dont't mind the trip to the server, it's easy. just have php
print the selects according to the submitted values.

using javscript - possible, but maybe not good

1. many people have turned off javascript. they will never be able to
use your search, unless you build in a fallback.

2. you'll have to include every possible choice for the selects in the
code from the very start (because there is no trip back to the server),
which is likely to make huge files - not good

3. if you want to use javascript anyway: have a look at DOM, especially
appending, removing and altering children (because every option of a
select is a child to that select)

micha

Reply With Quote
  #3 (permalink)  
Old 04-28-2005
Good Man
 
Posts: n/a
Default Re: Dynamically change a dropdown menu according to another menu?

"micha" <chotiwallah@web.de> wrote in news:1114687283.519957.306190
@f14g2000cwb.googlegroups.com:


> 1. many people have turned off javascript. they will never be able to
> use your search, unless you build in a fallback.


really? "many people"?

anyone that disables javascript is probably used to many websites not
working properly, and have probably switched it on by now.

I just can't see anyone going into browser settings and shutting off
javascript in 2005...
Reply With Quote
  #4 (permalink)  
Old 04-28-2005
R. Rajesh Jeba Anbiah
 
Posts: n/a
Default Re: Dynamically change a dropdown menu according to another menu?

micha wrote:
<snip>
> 1. many people have turned off javascript. they will never be able to
> use your search, unless you build in a fallback.


That's why the PHP version has to be first done and the JavaScript
"speeding up processes" have to be lately--by hooking the forms and
elements (using external js file) and act accordingly than by mixing
JavaScript with HTML.

> 2. you'll have to include every possible choice for the selects in

the
> code from the very start (because there is no trip back to the

server),
> which is likely to make huge files - not good


Yes, buffering in JS isn't a better solution. But, AJAX technique
might be used to avoid memory issues.

--
<?php echo 'Just another PHP saint'; ?>
Email: rrjanbiah-at-Y!com Blog: http://rajeshanbiah.blogspot.com/

Reply With Quote
  #5 (permalink)  
Old 04-28-2005
micha
 
Posts: n/a
Default Re: Dynamically change a dropdown menu according to another menu?


Good Man wrote:
> "micha" <chotiwallah@web.de> wrote in news:1114687283.519957.306190
> @f14g2000cwb.googlegroups.com:
>
>
> > 1. many people have turned off javascript. they will never be able

to
> > use your search, unless you build in a fallback.

>
> really? "many people"?
>


well, "many" is just a phrase i use in these cases. it's probably not
that many in numbers, but consider for instance people accessing the
net with other hard-/software than screen/browser, like blind people
using braille readers.
i do web developement for the public sector in germany. we must (by
law) design apps accessible to everyone, which forbids to code any
crucial functionality in js.

> anyone that disables javascript is probably used to many websites not


> working properly, and have probably switched it on by now.
>
> I just can't see anyone going into browser settings and shutting off
> javascript in 2005...


Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT +1. The time now is 11:16 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0