Flowdock
method

observe_form

Importance_2
Ruby on Rails latest stable (v4.0.2) - 1 note - Class: ActionView::Helpers::PrototypeHelper

Method deprecated or moved

This method is deprecated or moved on the latest stable version. The last existing version (v2.3.8) is shown here.

observe_form(form_id, options = {}) public

Observes the form with the DOM ID specified by form_id and calls a callback when its contents have changed. The default callback is an Ajax call. By default all fields of the observed field are sent as parameters with the Ajax call.

The options for observe_form are the same as the options for observe_field. The JavaScript variable value available to the :with option is set to the serialized form by default.

Show source
Register or log in to add new notes.
October 6, 2008 - (<= v2.1.0)
1 thank

Multiple select and observe form

To make an observe form send all of the values selected in a multiple select html list, ensure you have the square brackets set in the name for the select tag e.g: group[]. This makes it pass the selected options in the params hash as an array.

<% remote_form_for :model, :url => {:action => ‘list’}, :html =>{:id => ‘model_id’} do |form| %>

<%= select_tag(‘group[]’, options_for_select(Model.find(:all).collect{|v|v.property}), :multiple => true) %>

<% end %>

<%= observe_form( ‘model’, :frequency => 2, :url => {:action => ‘list’} ) %>