By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
431,827 Members | 2,155 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 431,827 IT Pros & Developers. It's quick & easy.

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

P: n/a
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
Jul 17 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
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

Jul 17 '05 #2

P: n/a
"micha" <ch*********@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...
Jul 17 '05 #3

P: n/a
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/

Jul 17 '05 #4

P: n/a

Good Man wrote:
"micha" <ch*********@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...


Jul 17 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.