This is easily a dhtml issue, or one that can likely be performed in
rjs. (repopulating 'b') when someting occurs. Additionally, here is
working code I use to pick up when a dropdown's selection has changed:
<% form_for :channels, :html => {:name => 'channelsform'},:url=>
{ :action =>"newchannel", :controller =>"channels"} do |f| %>
<%= f.label "Channel" %>
<%= select("channel", "id", Channel.find(:all, :order => 'channel
ASC', :conditions => ['deleted=0']).collect {|p| [ p.channel,
p.id ]}, { :include_blank => true}, { :onchange =>
"document.channelsform.submit();"}) %>
<input type="hidden" name="minimenu" value="<%= @minimenu %>" />
<%end%>
It;s a little polluted with real-world dictates, but I dont want to
hack things out for trhis example and give you a broken example
inadvertently. The meat occurs in the :onchange where the form is
submitted in this case (when the user changes their selection).
Incidentally, this occurs in a partial, which then executes the
Channelscontroller.newchannel method. Perhaps you make a partial
holding dropdown 'b' and repopulate it in such a method? That should
work fine -Janna B
On Jul 8, 2:46 am, Rails List <[email protected]>
wrote:
> I have two dropdowns 'a' and 'b'. when something is selected on 'a',
> its onchange event has an action and an update area which works fine.
>
> but when it comes to editing a record, i am able to list items in 'a'
> dropdown and select the current value but this leave 'b' dropdown empty.
>
> i would like to trigger an onchange or onclick event for 'a's selected
> value so that 'b' drop down is populated correctly.
>
> any ideas?
> --
> Posted viahttp://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 [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---