Re: dynamic lists

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





On Jan 17, 2007, at 1:39 PM, Brad Fuller wrote:

-----Original Message-----
From: Jay Blanchard [mailto:jblanchard@xxxxxxxxxx]
Sent: Wednesday, January 17, 2007 4:05 PM
To: Don; php-general@xxxxxxxxxxxxx
Subject: RE:  dynamic lists

[snip]
By dynamic drop list I mean the type where the options
contained in the subsequent list depend on what was picked in
the previous list without clicking submit.
[/snip]

PHP is server side, you need to do this with AJAX or Javascript

--
PHP General Mailing List (http://www.php.net/) To
unsubscribe, visit: http://www.php.net/unsub.php


Don,

There's a few different ways to do this.

#1) Submit the form (to itself) when a user chooses an option from the first list (using onChange=form.submit()) then with PHP query the database for the
second set of options.

#2) Use JavaScript to store all the values and pop them in when the user chooses an option from the first list (using onChange=someFunction (...)).

I like #2. If you need a starting point, google for "javascript dynamic
select list"

Hope that helps,

Brad

FYI... Neither #1 or #2 are considered good practice for Accessibility/ADA compliance. If you are using a keyboard or screen reader to view your website, it will always pick the first one in the list and you won't have the option of even seeing the rest of the list. Basically, anything that uses onchange or onselect will cause accessibility issues. The only way to accomplish this is using onclick or submitting the form.

--
Kevin Murphy
Webmaster: Information and Marketing Services
Western Nevada Community College
www.wncc.edu
775-445-3326


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux