Home > Rails Reference > Rails and observe_form

Rails and observe_form

In using the method observe_form in Rails, your form should be created with the option :id.  Otherwise, the observe_form won’t be able to locate the form and javascript error is encountered in prototype.js.

Sample code snippet in the rhtml:

<% form_tag(‘javascript:void(0)’, :id => ‘my_form’) do %>

<% end %>

<%=  observe_form :my_form,
: url  => {:action => ‘new’} %>

Categories: Rails Reference
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: