Search code examples
ruby-on-railsobserver-pattern

rails observe_field


i have used observed_field for arrays of data... but i am having trouble making a simple, one field application of it work. i must be missing a very simple detail. have searched extensively for basic syntax and cannot find anything that applies. when i change the selection, the change is not saved and there is no error msg.

<% form_for :team, :url => update_item_leader_group_path do |f| %>

    <%= f.select :item_id, @selection_collection %>  

    <span id="trigger_spinner" style="visibility: hidden;">
        <img src="/images/spinner.gif" alt="Loading..." />
    </span>

    <%= observe_field 'group_item_id',  
        :url => { :controller => :group, :action => :update_item },  
        :method => :put,  
        :with => "'trig=' + $('group_item_id').value" %>
        :loading => "$('trigger_spinner').setStyle({visibility: 'visible'});",
        :complete => "$('trigger_spinner').setStyle({visibility: 'hidden'});" %>

<% end %>

Solution

  • The id of the field is usually something like id='group_item_id', could this be the issue?