validar el formulario en ambos botones

This commit is contained in:
f 2018-07-23 11:26:40 -03:00
parent 97b2f7c87d
commit b79bc1735f
No known key found for this signature in database
GPG key ID: F3FDAB97B5F9F7E7
2 changed files with 3 additions and 3 deletions

View file

@ -6,7 +6,7 @@ $(document).on('turbolinks:load', function() {
}
});
$('#submit-post').click(function(e) {
$('.submit-post').click(function(e) {
var form = $(this).parents('form.form');
if (form[0].checkValidity() === false) {

View file

@ -18,7 +18,7 @@
= form_tag url, method: method, class: 'form', novalidate: true, multipart: true do
= hidden_field_tag 'template', params[:template]
.form-group
= submit_tag t('posts.save'), class: 'btn btn-success'
= submit_tag t('posts.save'), class: 'btn btn-success submit-post'
.form-group
= label_tag 'post_dir', t('posts.dir')
= select_tag 'post[dir]',
@ -98,4 +98,4 @@
= render "posts/template_field/#{type}", template: template, name: template.key, value: value
.invalid-feedback= t('posts.invalid')
.form-group
= submit_tag t('posts.save'), class: 'btn btn-success', id: 'submit-post'
= submit_tag t('posts.save'), class: 'btn btn-success submit-post'