SolutionCottage.com
Posted  11 Sep 2009 - 21:50:08

Category: Ruby on Rails


Perform validation before sending Rails form

Issue:
You want to add some sort of javascript validation before submiting your form.

Solution:
You could add the :before attribute to your form. You can put any js in here and I personally used it to add data from an iframe to a hidden field that was passed on to the controller.

form_remote_tag :url => "/login", :update => 'temp', :before => 'if( !validate(this) ) return false' do



Marked as helpful by 1 user




0 comments:








© SolutionCottage 2008-2011 7/25/2017 7:28:48 AM