mirror of
https://0xacab.org/sutty/sutty
synced 2024-11-26 07:46:21 +00:00
capturar el evento de envío del formulario closes #231
This commit is contained in:
parent
6467f6b09c
commit
69f1687962
2 changed files with 6 additions and 7 deletions
|
@ -1,11 +1,10 @@
|
|||
document.addEventListener('turbolinks:load', () => {
|
||||
// Al enviar el formulario del artículo, aplicar la validación
|
||||
// localmente y actualizar los comentarios para lectores de pantalla.
|
||||
document.querySelectorAll('.submit-post').forEach(submit => {
|
||||
submit.addEventListener('click', event => {
|
||||
const form = submit.closest('form')
|
||||
const invalid_help = form.querySelectorAll('.invalid_help')
|
||||
const sending_help = form.querySelectorAll('.sending_help')
|
||||
document.querySelectorAll('form').forEach(form => {
|
||||
form.addEventListener('submit', event => {
|
||||
const invalid_help = form.querySelectorAll('.invalid-help')
|
||||
const sending_help = form.querySelectorAll('.sending-help')
|
||||
|
||||
invalid_help.forEach(i => i.classList.add('d-none'))
|
||||
sending_help.forEach(i => i.classList.add('d-none'))
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
.form-group
|
||||
= submit_tag t('.save'), class: 'btn submit-post'
|
||||
.invalid_help.alert.alert-danger.d-none
|
||||
.invalid-help.alert.alert-danger.d-none
|
||||
= site.config.fetch('invalid_help', t('.invalid_help'))
|
||||
.sending_help.alert.alert-success.d-none
|
||||
.sending-help.alert.alert-success.d-none
|
||||
= site.config.fetch('sending_help', t('.sending_help'))
|
||||
|
|
Loading…
Reference in a new issue