Taher, Gil, Jacques, I've created the Jira ticket for the same: https://issues.apache.org/jira/browse/OFBIZ-10432
Will soon have someone to take care, thanks again for your help! Rishi Solanki Sr Manager, Enterprise Software Development HotWax Systems Pvt. Ltd. Direct: +91-9893287847 http://www.hotwaxsystems.com www.hotwax.co On Mon, Jun 11, 2018 at 3:15 PM, Taher Alkhateeb <slidingfilame...@gmail.com > wrote: > Yeah I apologize for making too much noise in this thread, perhaps it > would have been better discussed in JIRA. > > The reason I open these subjects up from time to time is to generally > try to unify code. Whenever I see an opportunity to unify the way > stuff works around the framework I cannot resist the temptation to at > least mention it. What you mentioned makes sense with respect to > combinations of "when" combined with either "text" or "display". > However it would be nice to do it also perhaps for interactive forms > with things like "container" fields or "include-form" directives > triggered by update events. > > In any case, I don't see a problem working with this for now as we > figure out better options. I just hope we don't get a lot of code > deployed on top of that before / if we decide to change it. > > On Mon, Jun 11, 2018 at 12:26 PM, Rishi Solanki <rishisolan...@gmail.com> > wrote: > > Thanks Taher, Gil, Jacques for you feedback. > > > > I'll get back and take your inputs into consideration and all seems > > acceptable to me. For Taher's point I remember we have use when and read > > only (display field) checks and ignored tag to make the field non > editable > > and non parameterized. This is only for brainstorming on the proposal. > And > > I tend to agree to apply this on all fields but for checkboxes we often > use > > disabled feature which is not applicable to all other type of inputs. > > > > I hope this would be fine, if we discuss this and slowly take care of > > suggestions after that. For Gil's suggestion I would change it asap. > > > > Thanks again for your help! > > > > > > Rishi Solanki > > Sr Manager, Enterprise Software Development > > HotWax Systems Pvt. Ltd. > > Direct: +91-9893287847 > > http://www.hotwaxsystems.com > > www.hotwax.co > > > > On Sun, Jun 10, 2018 at 1:37 PM, Jacques Le Roux < > > jacques.le.r...@les7arts.com> wrote: > > > >> +1 Gil > >> > >> Jacques > >> > >> > >> > >> Le 10/06/2018 à 08:34, Gil Portenseigne a écrit : > >> > >>> Hi Rishi, > >>> > >>> In the xsd it's better to use xs:boolean type, instead of enumeration > >>> type. > >>> > >>> Regards, > >>> > >>> Gil > >>> > >>> > >>> Le 9 juin 2018 14:34:49 GMT+02:00, ri...@apache.org a écrit : > >>> > >>>> Author: rishi > >>>> Date: Sat Jun 9 12:34:49 2018 > >>>> New Revision: 1833231 > >>>> > >>>> URL: http://svn.apache.org/viewvc?rev=1833231&view=rev > >>>> Log: > >>>> Improved: Add Support for Disable attribute in CheckBox Form Widget. > >>>> Disabled attrivute can be used as > >>>> > >>>> <field><check disabled=true/></field> > >>>> > >>>> and default value for attribute will be false. > >>>> (OFBIZ-10367) > >>>> Thanks Pawan Verma for reporting the improvement and providing patch > >>>> for that. > >>>> Thanks James Yong for testing the work. > >>>> > >>>> Modified: > >>>> ofbiz/ofbiz-framework/trunk/framework/widget/dtd/widget-form.xsd > >>>> ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/ > >>>> org/apache/ofbiz/widget/model/ModelFormField.java > >>>> ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/ > >>>> org/apache/ofbiz/widget/model/XmlWidgetFieldVisitor.java > >>>> ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/ > >>>> org/apache/ofbiz/widget/renderer/macro/MacroFormRenderer.java > >>>> ofbiz/ofbiz-framework/trunk/themes/common-theme/template/mac > >>>> ro/CsvFormMacroLibrary.ftl > >>>> ofbiz/ofbiz-framework/trunk/themes/common-theme/template/mac > >>>> ro/FoFormMacroLibrary.ftl > >>>> ofbiz/ofbiz-framework/trunk/themes/common-theme/template/mac > >>>> ro/HtmlFormMacroLibrary.ftl > >>>> ofbiz/ofbiz-framework/trunk/themes/common-theme/template/mac > >>>> ro/TextFormMacroLibrary.ftl > >>>> ofbiz/ofbiz-framework/trunk/themes/common-theme/template/mac > >>>> ro/XlsFormMacroLibrary.ftl > >>>> ofbiz/ofbiz-framework/trunk/themes/common-theme/template/mac > >>>> ro/XmlFormMacroLibrary.ftl > >>>> > >>>> Modified: > >>>> ofbiz/ofbiz-framework/trunk/framework/widget/dtd/widget-form.xsd > >>>> URL: > >>>> http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/fra > >>>> mework/widget/dtd/widget-form.xsd?rev=1833231&r1=1833230&r2= > >>>> 1833231&view=diff > >>>> ============================================================ > >>>> ================== > >>>> --- ofbiz/ofbiz-framework/trunk/framework/widget/dtd/widget-form.xsd > >>>> (original) > >>>> +++ ofbiz/ofbiz-framework/trunk/framework/widget/dtd/widget-form.xsd > >>>> Sat Jun 9 12:34:49 2018 > >>>> @@ -956,6 +956,14 @@ under the License. > >>>> </xs:restriction> > >>>> </xs:simpleType> > >>>> </xs:attribute> > >>>> + <xs:attribute name="disabled" default="false"> > >>>> + <xs:simpleType> > >>>> + <xs:restriction base="xs:token"> > >>>> + <xs:enumeration value="true" /> > >>>> + <xs:enumeration value="false" /> > >>>> + </xs:restriction> > >>>> + </xs:simpleType> > >>>> + </xs:attribute> > >>>> </xs:complexType> > >>>> </xs:element> > >>>> <xs:element name="container" substitutionGroup="AllFields"> > >>>> > >>>> Modified: > >>>> ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/ > >>>> org/apache/ofbiz/widget/model/ModelFormField.java > >>>> URL: > >>>> http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/fra > >>>> mework/widget/src/main/java/org/apache/ofbiz/widget/model/ > >>>> ModelFormField.java?rev=1833231&r1=1833230&r2=1833231&view=diff > >>>> ============================================================ > >>>> ================== > >>>> --- > >>>> ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/ > >>>> org/apache/ofbiz/widget/model/ModelFormField.java > >>>> (original) > >>>> +++ > >>>> ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/ > >>>> org/apache/ofbiz/widget/model/ModelFormField.java > >>>> Sat Jun 9 12:34:49 2018 > >>>> @@ -980,25 +980,30 @@ public class ModelFormField { > >>>> public static class CheckField extends FieldInfoWithOptions { > >>>> public final static String ROW_SUBMIT_FIELD_NAME = > "_rowSubmit"; > >>>> private final FlexibleStringExpander allChecked; > >>>> + private final boolean disabled; > >>>> > >>>> private CheckField(CheckField original, ModelFormField modelFormField) > >>>> { > >>>> super(original, modelFormField); > >>>> this.allChecked = original.allChecked; > >>>> + this.disabled = original.disabled; > >>>> } > >>>> > >>>> public CheckField(Element element, ModelFormField modelFormField) > { > >>>> super(element, modelFormField); > >>>> allChecked = > >>>> FlexibleStringExpander.getInstance(element. > getAttribute("all-checked")); > >>>> + this.disabled = > >>>> "true".equals(element.getAttribute("disabled")); > >>>> } > >>>> > >>>> public CheckField(int fieldSource, ModelFormField modelFormField) > { > >>>> super(fieldSource, FieldInfo.CHECK, modelFormField); > >>>> this.allChecked = FlexibleStringExpander. > getInstance(""); > >>>> + this.disabled = false; > >>>> } > >>>> > >>>> public CheckField(ModelFormField modelFormField) { > >>>> super(FieldInfo.SOURCE_EXPLICIT, FieldInfo.CHECK, > modelFormField); > >>>> this.allChecked = FlexibleStringExpander. > getInstance(""); > >>>> + this.disabled = false; > >>>> } > >>>> > >>>> @Override > >>>> @@ -1023,6 +1028,10 @@ public class ModelFormField { > >>>> return null; > >>>> } > >>>> > >>>> + public boolean getDisabled() { > >>>> + return this.disabled; > >>>> + } > >>>> + > >>>> @Override > >>>> public void renderFieldString(Appendable writer, Map<String, Object> > >>>> context, FormStringRenderer formStringRenderer) > >>>> throws IOException { > >>>> @@ -4335,4 +4344,4 @@ public class ModelFormField { > >>>> formStringRenderer.renderTextFindField(writer, context, > this); > >>>> } > >>>> } > >>>> -} > >>>> +} > >>>> \ No newline at end of file > >>>> > >>>> Modified: > >>>> ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/ > >>>> org/apache/ofbiz/widget/model/XmlWidgetFieldVisitor.java > >>>> URL: > >>>> http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/fra > >>>> mework/widget/src/main/java/org/apache/ofbiz/widget/model/ > >>>> XmlWidgetFieldVisitor.java?rev=1833231&r1=1833230&r2= > 1833231&view=diff > >>>> ============================================================ > >>>> ================== > >>>> --- > >>>> ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/ > >>>> org/apache/ofbiz/widget/model/XmlWidgetFieldVisitor.java > >>>> (original) > >>>> +++ > >>>> ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/ > >>>> org/apache/ofbiz/widget/model/XmlWidgetFieldVisitor.java > >>>> Sat Jun 9 12:34:49 2018 > >>>> @@ -68,6 +68,7 @@ public class XmlWidgetFieldVisitor exten > >>>> visitModelField(checkField.getModelFormField()); > >>>> writer.append("<check"); > >>>> visitAttribute("all-checked", checkField.getAllChecked()); > >>>> + visitAttribute("disabled", checkField.getDisabled()); > >>>> visitFieldInfoWithOptions(checkField); > >>>> writer.append("</check></field>"); > >>>> } > >>>> > >>>> Modified: > >>>> ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/ > >>>> org/apache/ofbiz/widget/renderer/macro/MacroFormRenderer.java > >>>> URL: > >>>> http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/fra > >>>> mework/widget/src/main/java/org/apache/ofbiz/widget/render > >>>> er/macro/MacroFormRenderer.java?rev=1833231&r1=1833230& > >>>> r2=1833231&view=diff > >>>> ============================================================ > >>>> ================== > >>>> --- > >>>> ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/ > >>>> org/apache/ofbiz/widget/renderer/macro/MacroFormRenderer.java > >>>> (original) > >>>> +++ > >>>> ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/ > >>>> org/apache/ofbiz/widget/renderer/macro/MacroFormRenderer.java > >>>> Sat Jun 9 12:34:49 2018 > >>>> @@ -1019,6 +1019,7 @@ public final class MacroFormRenderer imp > >>>> String currentValue = modelFormField.getEntry(context); > >>>> String conditionGroup = modelFormField.getConditionGroup(); > >>>> Boolean allChecked = checkField.isAllChecked(context); > >>>> + boolean disabled = checkField.getDisabled(); > >>>> String id = modelFormField.getCurrentContainerId(context); > >>>> String className = ""; > >>>> String alert = "false"; > >>>> @@ -1073,7 +1074,9 @@ public final class MacroFormRenderer imp > >>>> } > >>>> sr.append("\" tabindex=\""); > >>>> sr.append(tabindex); > >>>> - sr.append("\" />"); > >>>> + sr.append("\" disabled="); > >>>> + sr.append(Boolean.toString(disabled)); > >>>> + sr.append(" />"); > >>>> executeMacro(writer, sr.toString()); > >>>> this.appendTooltip(writer, context, modelFormField); > >>>> } > >>>> > >>>> Modified: > >>>> ofbiz/ofbiz-framework/trunk/themes/common-theme/template/mac > >>>> ro/CsvFormMacroLibrary.ftl > >>>> URL: > >>>> http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/the > >>>> mes/common-theme/template/macro/CsvFormMacroLibrary.ftl?rev= > >>>> 1833231&r1=1833230&r2=1833231&view=diff > >>>> ============================================================ > >>>> ================== > >>>> --- > >>>> ofbiz/ofbiz-framework/trunk/themes/common-theme/template/mac > >>>> ro/CsvFormMacroLibrary.ftl > >>>> (original) > >>>> +++ > >>>> ofbiz/ofbiz-framework/trunk/themes/common-theme/template/mac > >>>> ro/CsvFormMacroLibrary.ftl > >>>> Sat Jun 9 12:34:49 2018 > >>>> @@ -41,7 +41,7 @@ under the License. > >>>> </#macro> > >>>> > >>>> <#macro renderTooltip tooltip tooltipStyle></#macro> > >>>> -<#macro renderCheckField items className alert id allChecked > >>>> currentValue name event action conditionGroup tabindex></#macro> > >>>> +<#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></#macro> > >>>> > >>>> <#macro renderSubmitField buttonType className alert formName title > >>>> name event action imgSrc confirmation containerId ajaxUrl > >>>> tabindex></#macro> > >>>> > >>>> Modified: > >>>> ofbiz/ofbiz-framework/trunk/themes/common-theme/template/mac > >>>> ro/FoFormMacroLibrary.ftl > >>>> URL: > >>>> http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/the > >>>> mes/common-theme/template/macro/FoFormMacroLibrary.ftl?rev= > >>>> 1833231&r1=1833230&r2=1833231&view=diff > >>>> ============================================================ > >>>> ================== > >>>> --- > >>>> ofbiz/ofbiz-framework/trunk/themes/common-theme/template/mac > >>>> ro/FoFormMacroLibrary.ftl > >>>> (original) > >>>> +++ > >>>> ofbiz/ofbiz-framework/trunk/themes/common-theme/template/mac > >>>> ro/FoFormMacroLibrary.ftl > >>>> Sat Jun 9 12:34:49 2018 > >>>> @@ -67,7 +67,7 @@ under the License. > >>>> </#if> > >>>> </#macro> > >>>> > >>>> -<#macro renderCheckField items className alert id allChecked > >>>> currentValue name event action conditionGroup tabindex><@makeBlock "" > >>>> "" /></#macro> > >>>> +<#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><@makeBlock "" "" /></#macro> > >>>> > >>>> <#macro renderSubmitField buttonType className alert formName title > >>>> name event action imgSrc confirmation containerId ajaxUrl > >>>> tabindex><@makeBlock "" "" /></#macro> > >>>> > >>>> Modified: > >>>> ofbiz/ofbiz-framework/trunk/themes/common-theme/template/mac > >>>> ro/HtmlFormMacroLibrary.ftl > >>>> URL: > >>>> http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/the > >>>> mes/common-theme/template/macro/HtmlFormMacroLibrary.ftl? > >>>> rev=1833231&r1=1833230&r2=1833231&view=diff > >>>> ============================================================ > >>>> ================== > >>>> --- > >>>> ofbiz/ofbiz-framework/trunk/themes/common-theme/template/mac > >>>> ro/HtmlFormMacroLibrary.ftl > >>>> (original) > >>>> +++ > >>>> ofbiz/ofbiz-framework/trunk/themes/common-theme/template/mac > >>>> ro/HtmlFormMacroLibrary.ftl > >>>> Sat Jun 9 12:34:49 2018 > >>>> @@ -252,13 +252,14 @@ under the License. > >>>> </#if> > >>>> </#macro> > >>>> > >>>> -<#macro renderCheckField items className alert id name action > >>>> conditionGroup="" allChecked="" currentValue="" event="" tabindex=""> > >>>> +<#macro renderCheckField items className alert id name action > >>>> conditionGroup="" allChecked="" currentValue="" event="" tabindex="" > >>>> disabled=""> > >>>> <#if conditionGroup?has_content> > >>>> <input type="hidden" name="${name}_grp" > value="${conditionGroup}"/> > >>>> </#if> > >>>> <#list items as item> > >>>> <span <@renderClass className alert />><#rt/> > >>>> <input type="checkbox"<#if (item_index == 0)> > >>>> id="${id}"</#if><#rt/><#if tabindex?has_content> > >>>> tabindex="${tabindex}"</#if><#rt/> > >>>> + <#if disabled?has_content && disabled> > >>>> disabled="disabled"</#if><#rt/> > >>>> <#if allChecked?has_content && allChecked> checked="checked" <#elseif > >>>> allChecked?has_content && !allChecked> > >>>> <#elseif currentValue?has_content && currentValue==item.value> > >>>> checked="checked"</#if> > >>>> name="${name?default("")?html}" > >>>> value="${item.value?default("")?html}"<#if event?has_content> > >>>> ${event}="${action}"</#if>/><#rt/> > >>>> > >>>> Modified: > >>>> ofbiz/ofbiz-framework/trunk/themes/common-theme/template/mac > >>>> ro/TextFormMacroLibrary.ftl > >>>> URL: > >>>> http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/the > >>>> mes/common-theme/template/macro/TextFormMacroLibrary.ftl? > >>>> rev=1833231&r1=1833230&r2=1833231&view=diff > >>>> ============================================================ > >>>> ================== > >>>> --- > >>>> ofbiz/ofbiz-framework/trunk/themes/common-theme/template/mac > >>>> ro/TextFormMacroLibrary.ftl > >>>> (original) > >>>> +++ > >>>> ofbiz/ofbiz-framework/trunk/themes/common-theme/template/mac > >>>> ro/TextFormMacroLibrary.ftl > >>>> Sat Jun 9 12:34:49 2018 > >>>> @@ -41,7 +41,7 @@ under the License. > >>>> </#macro> > >>>> > >>>> <#macro renderTooltip tooltip tooltipStyle></#macro> > >>>> -<#macro renderCheckField items className alert id allChecked > >>>> currentValue name event action conditionGroup tabindex></#macro> > >>>> +<#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></#macro> > >>>> > >>>> <#macro renderSubmitField buttonType className alert formName title > >>>> name event action imgSrc confirmation containerId ajaxUrl > >>>> tabindex></#macro> > >>>> > >>>> Modified: > >>>> ofbiz/ofbiz-framework/trunk/themes/common-theme/template/mac > >>>> ro/XlsFormMacroLibrary.ftl > >>>> URL: > >>>> http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/the > >>>> mes/common-theme/template/macro/XlsFormMacroLibrary.ftl?rev= > >>>> 1833231&r1=1833230&r2=1833231&view=diff > >>>> ============================================================ > >>>> ================== > >>>> --- > >>>> ofbiz/ofbiz-framework/trunk/themes/common-theme/template/mac > >>>> ro/XlsFormMacroLibrary.ftl > >>>> (original) > >>>> +++ > >>>> ofbiz/ofbiz-framework/trunk/themes/common-theme/template/mac > >>>> ro/XlsFormMacroLibrary.ftl > >>>> Sat Jun 9 12:34:49 2018 > >>>> @@ -42,7 +42,7 @@ under the License. > >>>> > >>>> <#macro renderDropDownField name className alert id multiple formName > >>>> otherFieldName event action size firstInList currentValue > >>>> explicitDescription allowEmpty options fieldName otherFieldName > >>>> otherValue otherFieldSize dDFCurrent ajaxEnabled noCurrentSelectedKey > >>>> ajaxOptions frequency minChars choices autoSelect partialSearch > >>>> partialChars ignoreCase fullSearch conditionGroup > >>>> tabindex><@renderItemField explicitDescription "txf" > >>>> className/></#macro> > >>>> > >>>> -<#macro renderCheckField items className alert id allChecked > >>>> currentValue name event action conditionGroup > >>>> tabindex><@renderItemField currentValue "txf" className/></#macro> > >>>> +<#macro renderCheckField items className alert id allChecked > >>>> currentValue name event action conditionGroup tabindex > >>>> disabled><@renderItemField currentValue "txf" className/></#macro> > >>>> > >>>> <#macro renderRadioField items className alert currentValue > >>>> noCurrentSelectedKey name event action conditionGroup > >>>> tabindex><@renderItemField currentValue "txf" className/></#macro> > >>>> > >>>> > >>>> Modified: > >>>> ofbiz/ofbiz-framework/trunk/themes/common-theme/template/mac > >>>> ro/XmlFormMacroLibrary.ftl > >>>> URL: > >>>> http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/the > >>>> mes/common-theme/template/macro/XmlFormMacroLibrary.ftl?rev= > >>>> 1833231&r1=1833230&r2=1833231&view=diff > >>>> ============================================================ > >>>> ================== > >>>> --- > >>>> ofbiz/ofbiz-framework/trunk/themes/common-theme/template/mac > >>>> ro/XmlFormMacroLibrary.ftl > >>>> (original) > >>>> +++ > >>>> ofbiz/ofbiz-framework/trunk/themes/common-theme/template/mac > >>>> ro/XmlFormMacroLibrary.ftl > >>>> Sat Jun 9 12:34:49 2018 > >>>> @@ -49,7 +49,7 @@ under the License. > >>>> <#macro renderDropDownField name className alert id multiple formName > >>>> otherFieldName event action size firstInList currentValue > >>>> explicitDescription allowEmpty options fieldName otherFieldName > >>>> otherValue otherFieldSize dDFCurrent ajaxEnabled noCurrentSelectedKey > >>>> ajaxOptions frequency minChars choices autoSelect partialSearch > >>>> partialChars ignoreCase fullSearch conditionGroup tabindex> > >>>> </#macro> > >>>> > >>>> -<#macro renderCheckField items className alert id allChecked > >>>> currentValue name event action conditionGroup tabindex></#macro> > >>>> +<#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></#macro> > >>>> > >>>> <#macro renderSubmitField buttonType className alert formName title > >>>> name event action imgSrc confirmation containerId ajaxUrl > >>>> tabindex></#macro> > >>>> > >>> > >> >