1
<%= form_for(current_user, url: update_my_profile_path, :method => :post, remote: true ) do |f| %>

   First Name: <%= f.text_field :firstname, value: current_user.firstname %>
   Last Name: <%= f.text_field :lastname, value: current_user.lastname %>
   Phone No. <%= f.text_field :phone, value: current_user.phone  %>

<%= f.submit  'update details', remote: true  %>

validation in my Javascript file :

 $("#personal_profile_update form").validate({

        rules: {
                firstname: { //validation rule },

                lastname: { //validation rule }

                }, // End of the rules

      messages: {    } // End of the messges section
});

Here validation works nicely. but when i try to submit the form with remote: true option in both form & f.submit, it does not get submitted. once I remove this jquery.validate this form gets submitted with remote: true option.

is there any way to submit this form with remote: true option being applied validation rules active ???

Ajay
  • 4,199
  • 4
  • 27
  • 47

1 Answers1

0

This is discussed here and also Judge gem is for client-side validation. RailsCasts has a whole episode on using client-side-validation gem.

Community
  • 1
  • 1
dhaile
  • 23
  • 4