<%= 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 ???
This is discussed here and also Judge gem is for client-side validation. RailsCasts has a whole episode on using client-side-validation gem.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.