|
Posted by Colin McKinnon on 03/17/07 18:01
Paul Furman wrote:
> drblitzkrieg@gmail.com wrote:
>
>> 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.
>
> I think you just run a tiny script from the <option> onmouseclick which
> reloads the form, then when the form reloads, php sees the option value
> has been set & formats the second option list.
Its generally refered to as a cascaded select. The easiest way to acheive
the result is to generate javascript directly from your PHP code, or use an
ajax function to populate the second select. Regardless you'd be better
asking about this on a Javascript list.
Having said that, I much prefer the the old Mozilla behaviour of having
nested menus defined by optgroups but all borwsers now just use that as a
series of headers in what is still a single list. To implement the same
behaviour (i.e. all options in a single widget but nested) check out PHP
layers menu.
HTH
C.
Navigation:
[Reply to this message]
|