Jeroen Houben
2006-May-03 13:18 UTC
[Rails] form :onblur => ''this.form.submit()'' doesn''t do AJAX
Hi, I''m looking to create a form that gets submitted using AJAX after an element loses focus. <% remote_form_for :person, @person, :url => { :action => "save" }, :update => ''form'' do |f| %> <label for="person_fname"><span class="req">*</span>Name</label> <div class="form_el"> <%= f.text_field :naam, :size=>50, :onblur => ''this.form.submit()'' %> </div> <% end %> This doesn''t work though, it submits the form using a plain old POST. Any ideas on how to accomplish this? Thanks in advance, Jeroen
Jeroen Houben
2006-May-03 13:53 UTC
[Rails] form :onblur => ''this.form.submit()'' doesn''t do AJAX
Jeroen Houben wrote:> Hi, > > I''m looking to create a form that gets submitted using AJAX after an > element loses focus. >This seems to work: <%= f.text_field :name, :size=>50, :onblur => remote_function(:update => "form", :with => ''Form.serialize(this.form)'', :url => { :action => :presubmit }) %> Cheers, Jeroen