This is an automated email from the ASF dual-hosted git repository. nmalin pushed a commit to branch trunk in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git
The following commit(s) were added to refs/heads/trunk by this push: new 99696b0 Fixed: Xml Element Link type hidden-form fail to resolve the form (OFBIZ-12260) 99696b0 is described below commit 99696b022814958b67f8a573d90b75f71293dc28 Author: Nicolas Malin <nicolas.ma...@nereide.fr> AuthorDate: Tue Jun 22 09:38:03 2021 +0200 Fixed: Xml Element Link type hidden-form fail to resolve the form (OFBIZ-12260) When you generate a link with the type hidden-form and the link present an update area, on the click jquery failed to resolve the form. Example of a current link generate : <a href="javascript:ajaxSubmitFormUpdateAreas('ListProductMeterActionMenus_delete_LF_1__0', 'embedded13009956-a841-47d3-86b1-b1931e6b430e,https://localhost:8443/catalog/control/ListProductMeters,productId=GZ-1000')">javascript:ajaxSubmitFormUpdateAreas('ListProductMeterActionMenus_delete_LF_1__0', 'embedded13009956-a841-47d3-86b1-b1931e6b430e,https://localhost:8443/catalog/control/ListProductMeters,productId=GZ-1000')</a> The problem come from OfbizUtil.js:748 var $form = jQuery("#" + form) To solve it, we change the form resolution in the function ajaxSubmitFormUpdateAreas with use the form name instead the form id. Thanks to Xin Wang for this suggest to fix it. --- themes/common-theme/template/macro/HtmlFormMacroLibrary.ftl | 2 +- themes/common-theme/webapp/common/js/util/OfbizUtil.js | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/themes/common-theme/template/macro/HtmlFormMacroLibrary.ftl b/themes/common-theme/template/macro/HtmlFormMacroLibrary.ftl index 0c852d6..b6b4391 100644 --- a/themes/common-theme/template/macro/HtmlFormMacroLibrary.ftl +++ b/themes/common-theme/template/macro/HtmlFormMacroLibrary.ftl @@ -229,7 +229,7 @@ under the License. <input type="<#if containerId?has_content>button<#else>submit</#if>" <@renderClass className alert /> <#if id?has_content> id="${id}"</#if><#rt/> <#if name??> name="${name}"</#if><#if title?has_content> value="${title}"</#if><#if event?has_content> ${event}="${action}"</#if> - <#if containerId?has_content> onclick="<#if confirmation?has_content>if (confirm('${confirmation?js_string}')) </#if>ajaxSubmitFormUpdateAreas('${containerId}', '${ajaxUrl}')" + <#if containerId?has_content> onclick="<#if confirmation?has_content>if (confirm('${confirmation?js_string}')) </#if>ajaxSubmitFormUpdateAreas('${formName}', '${ajaxUrl}')" <#else><#if confirmation?has_content> onclick="return confirm('${confirmation?js_string}');"</#if> <#if tabindex?has_content> tabindex="${tabindex}"</#if><#rt/> </#if>/> diff --git a/themes/common-theme/webapp/common/js/util/OfbizUtil.js b/themes/common-theme/webapp/common/js/util/OfbizUtil.js index e90fe39..7412474 100644 --- a/themes/common-theme/webapp/common/js/util/OfbizUtil.js +++ b/themes/common-theme/webapp/common/js/util/OfbizUtil.js @@ -708,11 +708,11 @@ function submitFormInBackground(form, areaId, submitUrl) { } /** Submit form, update multiple areas (HTML container elements). - * @param form The form element + * @param formName The form name * @param areaCsvString The area CSV string. The CSV string is a flat array in the * form of: areaId, target, target parameters [, areaId, target, target parameters...]. */ -function ajaxSubmitFormUpdateAreas(form, areaCsvString) { +function ajaxSubmitFormUpdateAreas(formName, areaCsvString) { waitSpinnerShow(); hideErrorContainer = function() { jQuery('#content-messages').html(''); @@ -745,7 +745,7 @@ function ajaxSubmitFormUpdateAreas(form, areaCsvString) { waitSpinnerHide(); } - var $form = jQuery("#" + form), + var $form = jQuery("form[name='" + formName + "']"), data = null, processData = true, enctype = $form.attr("enctype"),