Crispy
2007-Dec-17 19:06 UTC
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? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Thorsten Mueller
2007-Dec-17 19:18 UTC
Re: Population of drop down list contents from a prior drop
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. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Greg Donald
2007-Dec-17 19:20 UTC
Re: Population of drop down list contents from a prior drop down selection
On Dec 17, 2007 1:06 PM, Crispy <cris_paltenghe-/E1597aS9LQAvxtiuMwx3w@public.gmane.org> wrote:> > 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?RJS and partials. Replace the second drop down with a new version when the first drop down is changed. -- Greg Donald http://destiney.com/ --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Ryan Bigg
2007-Dec-17 22:44 UTC
Re: Population of drop down list contents from a prior drop down selection
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 Donald <gdonald-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > On Dec 17, 2007 1:06 PM, Crispy <cris_paltenghe-/E1597aS9LQAvxtiuMwx3w@public.gmane.org> wrote: > > > > 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? > > RJS and partials. Replace the second drop down with a new version > when the first drop down is changed. > > > -- > Greg Donald > http://destiney.com/ > > > >-- Ryan Bigg http://www.frozenplague.net --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---