From 8bc57a533f702703184ef8eed45d8dc27da2392c Mon Sep 17 00:00:00 2001 From: Thomas Zilio Date: Mon, 26 Aug 2019 11:02:59 +0200 Subject: [PATCH] Fix #633 --- assets/src/js/functions/functions.js | 17 +++++++++++++++++ assets/src/js/functions/init.js | 13 +------------ 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/assets/src/js/functions/functions.js b/assets/src/js/functions/functions.js index 2f5ee2fbf..dde34ffd2 100644 --- a/assets/src/js/functions/functions.js +++ b/assets/src/js/functions/functions.js @@ -395,6 +395,8 @@ function submitAjax(form, data, callback, errorCallback) { data.id_plugin = data.id_plugin ? data.id_plugin : globals.id_plugin; data.ajax = 1; + prepareForm(form); + // Invio dei dati $(form).ajaxSubmit({ url: globals.rootdir + "/actions.php", @@ -425,6 +427,21 @@ function submitAjax(form, data, callback, errorCallback) { return valid; } +function prepareForm(form) { + $(form).find('input:disabled, select:disabled').prop('disabled', false); + + var hash = window.location.hash; + if (hash) { + var input = $('', { + type: 'hidden', + name: 'hash', + value: hash, + }); + + $(form).append(input); + } +} + function renderMessages() { // Visualizzazione messaggi $.ajax({ diff --git a/assets/src/js/functions/init.js b/assets/src/js/functions/init.js index f48f870cb..60b979fed 100644 --- a/assets/src/js/functions/init.js +++ b/assets/src/js/functions/init.js @@ -37,18 +37,7 @@ function init() { $(this).find('[type=submit]').prop("disabled", true).addClass("disabled"); - $(this).find('input:disabled, select:disabled').prop('disabled', false); - - var hash = window.location.hash; - if (hash) { - var input = $('', { - type: 'hidden', - name: 'hash', - value: hash, - }); - - $(this).append(input); - } + prepareForm(this); return true; }