This is an automated email from the ASF dual-hosted git repository.
jleroux 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 3c687a7 Improved: Form-Fields of certain types won't render IDs (OFBIZ-11957) 3c687a7 is described below commit 3c687a757c1085f49fda82fdbfe2e3af13b0e243 Author: Jacques Le Roux <[hidden email]> AuthorDate: Thu Aug 20 15:14:20 2020 +0200 Improved: Form-Fields of certain types won't render IDs (OFBIZ-11957) While implementing some OFBiz-Forms, I noticed, that certain types of form-fields will not render the set ID. Field-Types that won't work for sure are {{submit}} and {{hyperlink}} where the set name for the parameter {{id-name}} simply will not be rendered in the HTML-Code that is generated by OFBiz. Thanks: Dennis Balkir --- .../org/apache/ofbiz/widget/renderer/macro/MacroFormRenderer.java | 5 ++++- themes/common-theme/template/macro/CsvFormMacroLibrary.ftl | 4 ++-- themes/common-theme/template/macro/FoFormMacroLibrary.ftl | 2 +- themes/common-theme/template/macro/HtmlFormMacroLibrary.ftl | 3 ++- themes/common-theme/template/macro/TextFormMacroLibrary.ftl | 4 ++-- themes/common-theme/template/macro/XlsFormMacroLibrary.ftl | 2 +- themes/common-theme/template/macro/XmlFormMacroLibrary.ftl | 2 +- 7 files changed, 13 insertions(+), 9 deletions(-) diff --git a/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/macro/MacroFormRenderer.java b/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/macro/MacroFormRenderer.java index 6b24009..2f7bb22 100644 --- a/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/macro/MacroFormRenderer.java +++ b/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/macro/MacroFormRenderer.java @@ -329,7 +329,7 @@ public final class MacroFormRenderer implements FormStringRenderer { this.request.setAttribute("alternate", encodedAlternate); this.request.setAttribute("imageTitle", encodedImageTitle); this.request.setAttribute("descriptionSize", hyperlinkField.getSize()); - this.request.setAttribute("id", hyperlinkField.getId(context)); + this.request.setAttribute("id", modelFormField.getCurrentContainerId(context)); this.request.setAttribute("width", hyperlinkField.getWidth()); this.request.setAttribute("height", hyperlinkField.getHeight()); makeHyperlinkByType(writer, hyperlinkField.getLinkType(), modelFormField.getWidgetStyle(), hyperlinkField.getUrlMode(), @@ -1178,6 +1178,7 @@ public final class MacroFormRenderer implements FormStringRenderer { public void renderSubmitField(Appendable writer, Map<String, Object> context, SubmitField submitField) throws IOException { ModelFormField modelFormField = submitField.getModelFormField(); ModelForm modelForm = modelFormField.getModelForm(); + String id = modelFormField.getCurrentContainerId(context); String event = modelFormField.getEvent(); String action = modelFormField.getAction(context); String title = modelFormField.getTitle(context); @@ -1225,6 +1226,8 @@ public final class MacroFormRenderer implements FormStringRenderer { sr.append(encode(title, modelFormField, context)); sr.append("\" name=\""); sr.append(name); + sr.append("\" id=\""); + sr.append(id); sr.append("\" event=\""); if (event != null) { sr.append(event); diff --git a/themes/common-theme/template/macro/CsvFormMacroLibrary.ftl b/themes/common-theme/template/macro/CsvFormMacroLibrary.ftl index ec64dd1..f973c6c 100644 --- a/themes/common-theme/template/macro/CsvFormMacroLibrary.ftl +++ b/themes/common-theme/template/macro/CsvFormMacroLibrary.ftl @@ -44,7 +44,7 @@ under the License. <#macro renderCheckField items className alert id allChecked currentValue name event action conditionGroup tabindex disabled></#macro> <#macro renderRadioField items className alert currentValue noCurrentSelectedKey name event action conditionGroup tabindex disabled></#macro> -<#macro renderSubmitField buttonType className alert formName title name event action imgSrc confirmation containerId ajaxUrl tabindex></#macro> +<#macro renderSubmitField buttonType className alert formName action imgSrc ajaxUrl id title name event confirmation containerId tabindex></#macro> <#macro renderResetField className alert name title></#macro> <#macro renderHiddenField name conditionGroup value id event action></#macro> @@ -122,4 +122,4 @@ under the License. <#macro renderAsterisks requiredField requiredStyle></#macro> <#macro makeHiddenFormLinkForm actionUrl name parameters targetWindow></#macro> <#macro makeHiddenFormLinkAnchor linkStyle hiddenFormName event action imgSrc description confirmation><@renderField description /></#macro> -<#macro makeHyperlinkString linkStyle hiddenFormName event action imgSrc title targetParameters alternate linkUrl targetWindow description confirmation uniqueItemName="" height="" width="" id=""><@renderField description />,<#rt/></#macro> \ No newline at end of file +<#macro makeHyperlinkString linkStyle hiddenFormName event action imgSrc title targetParameters alternate linkUrl targetWindow description confirmation uniqueItemName="" height="" width="" id=""><@renderField description />,<#rt/></#macro> diff --git a/themes/common-theme/template/macro/FoFormMacroLibrary.ftl b/themes/common-theme/template/macro/FoFormMacroLibrary.ftl index 21ef4a4..22f1584 100644 --- a/themes/common-theme/template/macro/FoFormMacroLibrary.ftl +++ b/themes/common-theme/template/macro/FoFormMacroLibrary.ftl @@ -70,7 +70,7 @@ under the License. <#macro renderCheckField items className alert id allChecked currentValue name event action conditionGroup tabindex disabled><@makeBlock "" "" /></#macro> <#macro renderRadioField items className alert currentValue noCurrentSelectedKey name event action conditionGroup tabindex disabled><@makeBlock "" "" /></#macro> -<#macro renderSubmitField buttonType className alert formName title name event action imgSrc confirmation containerId ajaxUrl tabindex><@makeBlock "" "" /></#macro> +<#macro renderSubmitField buttonType className alert formName action imgSrc ajaxUrl id title name event confirmation containerId tabindex><@makeBlock "" "" /></#macro> <#macro renderResetField className alert name title><@makeBlock "" "" /></#macro> <#macro renderHiddenField name conditionGroup value id event action><!--hidden--></#macro> diff --git a/themes/common-theme/template/macro/HtmlFormMacroLibrary.ftl b/themes/common-theme/template/macro/HtmlFormMacroLibrary.ftl index aa7bf74..b174450 100644 --- a/themes/common-theme/template/macro/HtmlFormMacroLibrary.ftl +++ b/themes/common-theme/template/macro/HtmlFormMacroLibrary.ftl @@ -205,7 +205,7 @@ under the License. </#list> </#macro> -<#macro renderSubmitField buttonType className alert formName action imgSrc ajaxUrl title="" name="" event="" confirmation="" containerId="" tabindex=""> +<#macro renderSubmitField buttonType className alert formName action imgSrc ajaxUrl id title="" name="" event="" confirmation="" containerId="" tabindex=""> <#if buttonType=="text-link"> <a <@renderClass className alert /> href="javascript:document.${formName}.submit()" <#if confirmation?has_content>onclick="return confirm('${confirmation?js_string}');"</#if>><#if title?has_content>${title}</#if> </a> <#elseif buttonType=="image"> @@ -214,6 +214,7 @@ under the License. <#if confirmation?has_content>onclick="return confirm('${confirmation?js_string}');"</#if>/> <#else> <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}')" <#else><#if confirmation?has_content> onclick="return confirm('${confirmation?js_string}');"</#if> diff --git a/themes/common-theme/template/macro/TextFormMacroLibrary.ftl b/themes/common-theme/template/macro/TextFormMacroLibrary.ftl index c7303e8..a7d7f67 100644 --- a/themes/common-theme/template/macro/TextFormMacroLibrary.ftl +++ b/themes/common-theme/template/macro/TextFormMacroLibrary.ftl @@ -44,7 +44,7 @@ under the License. <#macro renderCheckField items className alert id allChecked currentValue name event action conditionGroup tabindex disabled></#macro> <#macro renderRadioField items className alert currentValue noCurrentSelectedKey name event action conditionGroup tabindex disabled></#macro> -<#macro renderSubmitField buttonType className alert formName title name event action imgSrc confirmation containerId ajaxUrl tabindex></#macro> +<#macro renderSubmitField buttonType className alert formName action imgSrc ajaxUrl id title name event confirmation containerId tabindex></#macro> <#macro renderResetField className alert name title></#macro> <#macro renderHiddenField name conditionGroup value id event action></#macro> @@ -122,4 +122,4 @@ under the License. <#macro renderAsterisks requiredField requiredStyle>*</#macro> <#macro makeHiddenFormLinkForm actionUrl name parameters targetWindow></#macro> <#macro makeHiddenFormLinkAnchor linkStyle hiddenFormName event action imgSrc description confirmation><@renderField description /></#macro> -<#macro makeHyperlinkString linkStyle hiddenFormName event action imgSrc title targetParameters alternate linkUrl targetWindow description confirmation uniqueItemName="" height="" width="" id=""><@renderField description /></#macro> \ No newline at end of file +<#macro makeHyperlinkString linkStyle hiddenFormName event action imgSrc title targetParameters alternate linkUrl targetWindow description confirmation uniqueItemName="" height="" width="" id=""><@renderField description /></#macro> diff --git a/themes/common-theme/template/macro/XlsFormMacroLibrary.ftl b/themes/common-theme/template/macro/XlsFormMacroLibrary.ftl index 6d50f94..1e999f0 100644 --- a/themes/common-theme/template/macro/XlsFormMacroLibrary.ftl +++ b/themes/common-theme/template/macro/XlsFormMacroLibrary.ftl @@ -46,7 +46,7 @@ under the License. <#macro renderRadioField items className alert currentValue noCurrentSelectedKey name event action conditionGroup tabindex disabled><@renderItemField currentValue "txf" className/></#macro> -<#macro renderSubmitField buttonType className alert formName title name event action imgSrc confirmation containerId ajaxUrl tabindex></#macro> +<#macro renderSubmitField buttonType className alert formName action imgSrc ajaxUrl id title name event confirmation containerId tabindex></#macro> <#macro renderResetField className alert name title></#macro> diff --git a/themes/common-theme/template/macro/XmlFormMacroLibrary.ftl b/themes/common-theme/template/macro/XmlFormMacroLibrary.ftl index 6780b8c..68b0e4b 100644 --- a/themes/common-theme/template/macro/XmlFormMacroLibrary.ftl +++ b/themes/common-theme/template/macro/XmlFormMacroLibrary.ftl @@ -52,7 +52,7 @@ under the License. <#macro renderCheckField items className alert id allChecked currentValue name event action conditionGroup tabindex disabled></#macro> <#macro renderRadioField items className alert currentValue noCurrentSelectedKey name event action conditionGroup tabindex disabled></#macro> -<#macro renderSubmitField buttonType className alert formName title name event action imgSrc confirmation containerId ajaxUrl tabindex></#macro> +<#macro renderSubmitField buttonType className alert formName action imgSrc ajaxUrl id title name event confirmation containerId tabindex></#macro> <#macro renderResetField className alert name title></#macro> <#macro renderHiddenField name conditionGroup value id event action></#macro> |
Free forum by Nabble | Edit this page |