Dependant List Boxes


I would like to have a form with 2 listboxes each containing a list of suburbs.

but i would like the first to show suburbs that arent assigned to a user and the second to show the suburbs assigned to the user, eg mutually exclusive.

is it possible to use ajax to do this ? so that when its saved only the user table is updated

the form is used to manage users, for the user table, i have a suburb table and a usersuburb table

If your asking for a built-in implementation that does that, There is none. To do what you just described you will need to perform two queries and have one array that holds the suburbs that are not assigned to the user and the other that are assigned to a user. You can of course use Ajax to do that by using the $.ajax method.

thanks, i was thinking of having the 2 on a separate form, and loading them, then each listbox having a ajaxsubmitbutton that can update each list depending in the changes

$.ajax functions? is this the built in jquery library?

Yes. Though if you will try to use CHtml::ajaxButton in a content that is loaded via ajax that won’t work. see:

thanks, will look there.