From b79bc1735f10c53e51bce794500e3b7c9d9881f8 Mon Sep 17 00:00:00 2001 From: f Date: Mon, 23 Jul 2018 11:26:40 -0300 Subject: [PATCH] validar el formulario en ambos botones --- app/assets/javascripts/validation.js | 2 +- app/views/posts/_form.haml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/assets/javascripts/validation.js b/app/assets/javascripts/validation.js index 5aafef8..a26df10 100644 --- a/app/assets/javascripts/validation.js +++ b/app/assets/javascripts/validation.js @@ -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) { diff --git a/app/views/posts/_form.haml b/app/views/posts/_form.haml index 8816b60..3493a15 100644 --- a/app/views/posts/_form.haml +++ b/app/views/posts/_form.haml @@ -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'