Re: dynamic lists

From: Date: Wed, 17 Jan 2007 22:33:47 +0000
Subject: Re: dynamic lists
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-247269@lists.php.net to get a copy of this message
On Jan 17, 2007, at 2:20 PM, Jochem Maas wrote:
Kevin Murphy wrote:
On Jan 17, 2007, at 1:39 PM, Brad Fuller wrote:
-----Original Message----- From: Jay Blanchard [mailto:jblanchard@pocket.com] Sent: Wednesday, January 17, 2007 4:05 PM To: Don; php-general@lists.php.net Subject: RE: [PHP] 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.
that stance basically negates everything 'ajax', flash, video and everything considered to be remotely 'web2.0' - is the 'low-common-denominator' case always the correct choice? I understand the importance of accessibility but the practicality of most peoples' job in this sector means satisfying the requirements of a client that demands such dynamic functionality such as the auto-selection example given here. is there not an argument that screen-reader and [braille] keyboard software are somwhat responsible for being capable of 'keeping up' - given that an onclick can be handled why not an 'onchange' (in theory)?
Not saying I disagree with you..... which is why i tossed it out there as an FYI rather than anything else. But its something that you should be aware of when designing a site and weighing your options. For me, working for a governmental institution, I really don't have a choice. I can't throw anything into the website that has a negative ADA impact.... unless of course I have an alternate way of accomplishing the same thing. And yes, there is an argument that screen-readers should keep up with the technology, and I totally agree with you..... but that's not reality. Target.com got sued recently for lack of ADA compliance on their website. The screen reading software company wasn't the one sued. YMMV. -- Kevin Murphy Webmaster: Information and Marketing Services Western Nevada Community College www.wncc.edu 775-445-3326

« previous php.general (#247269) next »