Hello, I have a form with two observe_field, one on a select tag, the other on a checkbox. The form also has a text field. By default, the checkbox is not checked, the text field is disabled, and changing the select value will change the text field value. If the user checks the box, the text field is enabled, and the select doesn''t change it anymore. If unchecked, the text field is disabled again and the default behavior comes back. So far, I have the text field value right, but not its enabling/disabling. I guess that''s just some simple Ajax I''m missing on the :complete option, but I can''t find the right way to do it as it depends on the checkbox state. Or should that go in the controller? (where I put my #TODO lines...) Thanks, Karine Delvare form partial: <p><label for="book_collection_id">Collection</label><br/> <%= select(''book'', ''collection_id'', Collection.find(:all).collect {|c| [c.name, c.id]}) %></p> <p><label for="book_note">Note</label><br/> <input type="checkbox" id="book_overwrite_note" name="overwrite_note" checked)="<%= @overwrite_note %>"/> Give another note than the collection''s one<br/> <div id="ajaxWrapper"><%= render :partial => ''note'' %></div></p> <%= observe_field ''book_collection_id'', :update => "ajaxWrapper", :with => "''collection_id='' + encodeURIComponent(value) + ''&overwrite_note='' + escape($(''book_overwrite_note'').checked)", :url => {:controller => "user", :action => ''note''} %> <%= observe_field ''book_overwrite_note'', :update => "ajaxWrapper", :with => "''overwrite_note='' + encodeURIComponent(value) + ''&collection_id='' + escape($(''book_collection_id'').value)", :url => {:controller => "user", :action => ''note''} %> note partial: <input type="text" id="book_note" name="book[note]" value="<%= @note %>" disabled="true"/> controller: def note if (params[:overwrite_note] == "on" || params[:overwrite_note] == "true") #TODO: enable book_note else @url_landing = Collection.find(params[:collection_id]).note #TODO: disable book_note end render :partial => ''note'', :layout => false end --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---