From 87be1cd6e1dee124641b565634b91be04af93d76 Mon Sep 17 00:00:00 2001 From: Pek5892 Date: Wed, 19 Jul 2023 11:09:00 +0200 Subject: [PATCH] Fix #1206 --- assets/src/js/functions/init.js | 17 +++++++++++++++++ modules/interventi/add.php | 3 ++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/assets/src/js/functions/init.js b/assets/src/js/functions/init.js index 4da0a3735..b15e37963 100755 --- a/assets/src/js/functions/init.js +++ b/assets/src/js/functions/init.js @@ -43,6 +43,23 @@ function init() { if ($('form').length) { $('form').not('.no-check').parsley(); + + CKEDITOR.on('instanceReady', function () { + $('form textarea').each(function () { + if ($(this).attr('obbligatorio') === "1") { + $(this).attr('required', ''); + } + }); + + $.each(CKEDITOR.instances, function (instance) { + CKEDITOR.instances[instance].on("change", function (e) { + for (instance in CKEDITOR.instances) { + CKEDITOR.instances[instance].updateElement(); + $('form').parsley().validate(); + } + }); + }); + }); } // Aggiunta nell'URL del nome tab su cui tornare dopo il submit diff --git a/modules/interventi/add.php b/modules/interventi/add.php index 38488bf1f..86c3a436b 100755 --- a/modules/interventi/add.php +++ b/modules/interventi/add.php @@ -226,7 +226,8 @@ echo ' 'label' => tr('Richiesta'), 'name' => 'richiesta', 'id' => 'richiesta_add', - 'required' => '1', + 'obbligatorio' => 1, + 'required' => 1, 'value' => htmlentities($richiesta), 'extra' => 'style=\'max-height:80px;\'', ]);