Population of drop down list contents from a prior drop down selection

Suppose you have two drop down selects that are related. The contents
of both come from a database.You want the contents of the second one
to be dependent on the selection made in the first one, but don’t want
the user to have to hit SUBMIT to make the contents populate. For
example, say the goal is to implement a role based access framework
and the first drop down is the controllers available for a given
right. Once the user selects a controller, you want the next drop
down populated with only the actions available for that controller.

I suppose that this is an AJAX thing, but wasn’t sure how to do it.

Any suggestions?

the basic thing will be to place a form-submit in the onchange event of
the selectbox.

if this calls an ajax or a full page reload is a question of taste. it
would be faster, but is not absolutely necessary.

On Dec 17, 2007 1:06 PM, Crispy [email protected] wrote:

I suppose that this is an AJAX thing, but wasn’t sure how to do it.

Any suggestions?

RJS and partials. Replace the second drop down with a new version
when the first drop down is changed.


Greg D.
http://destiney.com/

I should warn you to replace the CONTENT of the second one, not the
actual
select box itself. I tried doing this in an app of mine and found out it
wasn’t putting it through in the submit.

On Dec 18, 2007 5:50 AM, Greg D. [email protected] wrote:

down populated with only the actions available for that controller.
Greg D.
http://destiney.com/


Ryan B.

Thorsten, keep in mind I’m new at this.
How do you detect in Rails if the list box is changed? How do you
take control at that point?

On Dec 17, 11:18 am, Thorsten M. <rails-mailing-l…@andreas-