Hello,
I have select field which after a choice happened, feeds another select
field.
Using the gem Cocoon to duplicate this set of select fields.
My problem now is to find a solution that the coffee script supplies values
for each select field-set separately.
My code:
form
<%= render 'usergroup_fields', :f => usergroup %>
<%= link_to_add_association "Add Group", f, :usergroups %>
usergroup_fields:
<%= f.select :ops_group_id, options_for_select(@groups…..{ id:
'ops_select'
} %>
<%= f.select :oncall_id, options_for_select(@oncalls….{ id:
'oncalls_select' } %>
Coffee:
$ ->
$(document).on 'change', ('#ops_select'), ->
$.ajax '/projects/update_oncalls/',
type: 'GET'
dataType: 'script'
data: {
ops_group_id: $("#ops_select option:selected").val()
update_oncalls.js
$("#oncalls_select").empty().append("<%=
escape_javascript(render(:partial
=> @oncalls)) %>")
I think I need some reference to supply to the script but don’t know how.
Any help would be great. Thanks
--
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit
https://groups.google.com/d/msgid/rubyonrails-talk/611498ac-ac05-4cf6-9c25-42329decfa60%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.