|
Posted by Manuel Lemos on 03/18/07 05:06
Hello,
on 03/17/2007 09:07 AM drblitzkrieg@gmail.com said the following:
> Hi, I have a page with 2 drop-down menus. The task is, when you select
> 1 menu, your selection then changes the options available in the
> other. This data happens to be drawn from a mysql database, so I
> wouldn't think that it could be done purely in Javascript, but rather
> a combination of PHP generating some JS code. Thing is, I don't even
> see how to change a set of menu options with JavaScript, only names
> and values of individual fields.
>
> Any hints and links to tutorials where the menu-changing part is
> explained would be appreciated.
This is a frequently asked need, for which there are ready to use
components for that purpose.
I use this forms generation class that comes with a plug-in that can do
exactly what you ask: link two or more selected inputs in such way when
the value of one changes, the options of the following are switched.
There is a variant of that plug-in that picks new groups of options from
a MySQL database using AJAX requests to avoid page reloading.
The class and the plug-ins may be found here:
http://www.phpclasses.org/formsgeneration
Here you can see an example of the plug-in in action:
http://www.meta-language.net/forms-examples.html?example=test_linked_select
Here you can watch a tutorial video about this plug-in:
http://www.phpclasses.org/browse/video/1/package/1/section/plugin-linked-select.html
--
Regards,
Manuel Lemos
Metastorage - Data object relational mapping layer generator
http://www.metastorage.net/
PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/
Navigation:
[Reply to this message]
|