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'...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
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 |
|
|||
|
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 |
|
|||
|
"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... |
|
|||
|
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/ |
|
|||
|
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... |