From 538122d1b6f9607556c224b80ffd076820fb4613 Mon Sep 17 00:00:00 2001 From: yflory Date: Fri, 3 Sep 2021 12:51:02 +0200 Subject: [PATCH] Fix submit/update button showing the wrong text --- www/form/inner.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/www/form/inner.js b/www/form/inner.js index 5689500cc..4ffdf3951 100644 --- a/www/form/inner.js +++ b/www/form/inner.js @@ -2485,7 +2485,7 @@ define([ }); }; - var makeFormControls = function (framework, content, update, evOnChange) { + var makeFormControls = function (framework, content, evOnChange) { var loggedIn = framework._.sfCommon.isLoggedIn(); var metadataMgr = framework._.cpNfInner.metadataMgr; var user = metadataMgr.getUserData(); @@ -2547,12 +2547,12 @@ define([ $cbox.after(h('div.alert.alert-info', Messages.form_authAnswer)); }); } - if (update && content.answers.cantEdit || APP.isClosed) { + if (APP.hasAnswered && content.answers.cantEdit || APP.isClosed) { $cbox.hide(); anonName = undefined; } - var send = h('button.cp-open.btn.btn-primary', update ? Messages.form_update : Messages.form_submit); + var send = h('button.cp-open.btn.btn-primary', APP.hasAnswered ? Messages.form_update : Messages.form_submit); var reset = h('button.cp-open.cp-reset-button.btn.btn-danger-alt', Messages.form_reset); $(reset).click(function () { if (!Array.isArray(APP.formBlocks)) { return; } @@ -2650,10 +2650,10 @@ define([ var $container = $('div.cp-form-creator-content'); var $inputs = $container.find('input:invalid'); if (!$inputs.length) { - $send.text(update ? Messages.form_update : Messages.form_submit); + $send.text(APP.hasAnswered ? Messages.form_update : Messages.form_submit); return void $invalid.empty(); } - $send.text(update ? Messages.form_updateWarning : Messages.form_submitWarning); + $send.text(APP.hasAnswered ? Messages.form_updateWarning : Messages.form_submitWarning); var lis = []; $inputs.each(function (i, el) { lis.push(gotoQuestion(el)); @@ -3578,7 +3578,7 @@ define([ } // In view mode, add "Submit" and "reset" buttons - $container.append(makeFormControls(framework, content, Boolean(answers), evOnChange)); + $container.append(makeFormControls(framework, content, evOnChange)); // In view mode, tell the user if answers are forced to be anonymous or authenticated var infoTxt;