From dd180e426e01ffa5de03879a38beda8813e62853 Mon Sep 17 00:00:00 2001 From: Sebastian Castro <sebastian.castro@protonmail.com> Date: Fri, 7 May 2021 14:44:48 +0200 Subject: [PATCH] form: fix checkbox custom checked value --- assets/js/element-form/initialisation.js | 4 ++-- src/Controller/ElementFormController.php | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/assets/js/element-form/initialisation.js b/assets/js/element-form/initialisation.js index bceefe1bf..3c2bb17ba 100755 --- a/assets/js/element-form/initialisation.js +++ b/assets/js/element-form/initialisation.js @@ -42,10 +42,10 @@ jQuery(document).ready(function() initializeToHtml() // Checkboxes, use custom checked value - $('input[type=checkbox]').change(function() { + $('input[type=checkbox][data-checked-value]').change(function() { if ($(this).val() == 'on' && $(this).data('checked-value') != 'on') $(this).val($(this).data('checked-value')) - }) + }).trigger('change') // TIMEPICKERS $('.timepicker').each(function(e) { diff --git a/src/Controller/ElementFormController.php b/src/Controller/ElementFormController.php index 6db16081a..3251e4ef5 100755 --- a/src/Controller/ElementFormController.php +++ b/src/Controller/ElementFormController.php @@ -295,14 +295,14 @@ class ElementFormController extends GoGoController $isAllowedPending = $configService->isUserAllowed('pending'); - $showResultLink = 'stayonform' == $submitOption && ($isAllowedDirectModeration || $isAllowedPending); + $showResultLink = $submitOption == 'stayonform' && ($isAllowedDirectModeration || $isAllowedPending); if ($showResultLink) { $noticeText .= '</br><a href="'.$elementShowOnMapUrl.'">Voir le résultat sur la carte</a>'; } $session->getFlashBag()->add('success', $noticeText); - if ('stayonform' != $submitOption && !$recopyInfo) { + if ($submitOption != 'stayonform' && !$recopyInfo) { return $this->redirect($elementShowOnMapUrl); } -- GitLab