Author: jleroux
Date: Thu May 21 16:29:49 2015 New Revision: 1680921 URL: http://svn.apache.org/r1680921 Log: Implements "The lookup and text-area have a read-only attribute but not the text input field" at https://issues.apache.org/jira/browse/OFBIZ-6395 Adds a read-only attribute to the text input field. Using the display type is not enough, because it's uneasy to assign values through Javascript as using the lookup description-field-name shows OOTB. And the disabled option is not good when you want to still show the submitted values on return. Also * improves widget-form.xsd documentation about read-only attribute for lookup * completes the foFormMacroLibrary.ftl where placeholder tabindex were missing (if this even ever makes sense) Modified: ofbiz/trunk/framework/widget/dtd/widget-form.xsd ofbiz/trunk/framework/widget/src/org/ofbiz/widget/renderer/macro/MacroFormRenderer.java ofbiz/trunk/framework/widget/templates/foFormMacroLibrary.ftl ofbiz/trunk/framework/widget/templates/htmlFormMacroLibrary.ftl ofbiz/trunk/framework/widget/templates/textFormMacroLibrary.ftl ofbiz/trunk/framework/widget/templates/xmlFormMacroLibrary.ftl Modified: ofbiz/trunk/framework/widget/dtd/widget-form.xsd URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/dtd/widget-form.xsd?rev=1680921&r1=1680920&r2=1680921&view=diff ============================================================================== --- ofbiz/trunk/framework/widget/dtd/widget-form.xsd (original) +++ ofbiz/trunk/framework/widget/dtd/widget-form.xsd Thu May 21 16:29:49 2015 @@ -1377,6 +1377,9 @@ under the License. </xs:simpleType> </xs:attribute> <xs:attribute name="read-only" default="false"> + <xs:annotation> + <xs:documentation>Makes the input field related to this lookup read-only (no edits allowed)</xs:documentation> + </xs:annotation> <xs:simpleType> <xs:restriction base="xs:token"> <xs:enumeration value="true" /> @@ -1595,6 +1598,17 @@ under the License. <xs:documentation>Defines a customized input mask. Use 9 for numeric, a for alpha and * for alphanumeric character.</xs:documentation> </xs:annotation> </xs:attribute> + <xs:attribute name="read-only" default="false"> + <xs:annotation> + <xs:documentation>Makes this text field read-only (no edits allowed)</xs:documentation> + </xs:annotation> + <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="textarea" substitutionGroup="AllFields"> Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/renderer/macro/MacroFormRenderer.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/renderer/macro/MacroFormRenderer.java?rev=1680921&r1=1680920&r2=1680921&view=diff ============================================================================== --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/renderer/macro/MacroFormRenderer.java (original) +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/renderer/macro/MacroFormRenderer.java Thu May 21 16:29:49 2015 @@ -361,6 +361,7 @@ public final class MacroFormRenderer imp } String ajaxUrl = createAjaxParamsFromUpdateAreas(updateAreas, "", context); boolean disabled = textField.getDisabled(); + boolean readonly = textField.getReadonly(); String tabindex = modelFormField.getTabindex(); StringWriter sr = new StringWriter(); sr.append("<@renderTextField "); @@ -388,6 +389,8 @@ public final class MacroFormRenderer imp } sr.append("\" disabled="); sr.append(Boolean.toString(disabled)); + sr.append(" readonly="); + sr.append(Boolean.toString(readonly)); sr.append(" clientAutocomplete=\""); sr.append(clientAutocomplete); sr.append("\" ajaxUrl=\""); Modified: ofbiz/trunk/framework/widget/templates/foFormMacroLibrary.ftl URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/templates/foFormMacroLibrary.ftl?rev=1680921&r1=1680920&r2=1680921&view=diff ============================================================================== --- ofbiz/trunk/framework/widget/templates/foFormMacroLibrary.ftl (original) +++ ofbiz/trunk/framework/widget/templates/foFormMacroLibrary.ftl Thu May 21 16:29:49 2015 @@ -50,7 +50,7 @@ under the License. </#macro> <#macro renderHyperlinkField></#macro> -<#macro renderTextField name className alert value textSize maxlength id event action disabled clientAutocomplete ajaxUrl ajaxEnabled mask><@makeBlock className value /></#macro> +<#macro renderTextField name className alert value textSize maxlength id event action disabled clientAutocomplete ajaxUrl ajaxEnabled mask placeholder tabindex readonly><@makeBlock className value /></#macro> <#macro renderTextareaField name className alert cols rows id readonly value visualEditorEnable language buttons><@makeBlock className value /></#macro> Modified: ofbiz/trunk/framework/widget/templates/htmlFormMacroLibrary.ftl URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/templates/htmlFormMacroLibrary.ftl?rev=1680921&r1=1680920&r2=1680921&view=diff ============================================================================== --- ofbiz/trunk/framework/widget/templates/htmlFormMacroLibrary.ftl (original) +++ ofbiz/trunk/framework/widget/templates/htmlFormMacroLibrary.ftl Thu May 21 16:29:49 2015 @@ -48,7 +48,7 @@ under the License. </#macro> <#macro renderHyperlinkField></#macro> -<#macro renderTextField name className alert value textSize maxlength id event action disabled clientAutocomplete ajaxUrl ajaxEnabled mask tabindex placeholder=""> +<#macro renderTextField name className alert value textSize maxlength id event action disabled clientAutocomplete ajaxUrl ajaxEnabled mask tabindex readonly placeholder=""> <#if mask?has_content> <script type="text/javascript"> jQuery(function($){jQuery("#${id}").mask("${mask}");}); @@ -60,6 +60,7 @@ under the License. <#if textSize?has_content> size="${textSize}"</#if><#rt/> <#if maxlength?has_content> maxlength="${maxlength}"</#if><#rt/> <#if disabled?has_content && disabled> disabled="disabled"</#if><#rt/> + <#if readonly?has_content && readonly> readonly="readonly"</#if><#rt/> <#if id?has_content> id="${id}"</#if><#rt/> <#if event?has_content && action?has_content> ${event}="${action}"</#if><#rt/> <#if clientAutocomplete?has_content && clientAutocomplete=="false"> autocomplete="off"</#if><#rt/> Modified: ofbiz/trunk/framework/widget/templates/textFormMacroLibrary.ftl URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/templates/textFormMacroLibrary.ftl?rev=1680921&r1=1680920&r2=1680921&view=diff ============================================================================== --- ofbiz/trunk/framework/widget/templates/textFormMacroLibrary.ftl (original) +++ ofbiz/trunk/framework/widget/templates/textFormMacroLibrary.ftl Thu May 21 16:29:49 2015 @@ -24,7 +24,7 @@ under the License. </#macro> <#macro renderHyperlinkField></#macro> -<#macro renderTextField name className alert value textSize maxlength id event action disabled clientAutocomplete ajaxUrl ajaxEnabled mask placeholder tabindex><@renderField value /></#macro> +<#macro renderTextField name className alert value textSize maxlength id event action disabled clientAutocomplete ajaxUrl ajaxEnabled mask placeholder tabindex readonly><@renderField value /></#macro> <#macro renderTextareaField name className alert cols rows id readonly value visualEditorEnable language buttons tabindex><@renderField value /></#macro> Modified: ofbiz/trunk/framework/widget/templates/xmlFormMacroLibrary.ftl URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/templates/xmlFormMacroLibrary.ftl?rev=1680921&r1=1680920&r2=1680921&view=diff ============================================================================== --- ofbiz/trunk/framework/widget/templates/xmlFormMacroLibrary.ftl (original) +++ ofbiz/trunk/framework/widget/templates/xmlFormMacroLibrary.ftl Thu May 21 16:29:49 2015 @@ -40,7 +40,7 @@ under the License. </#macro> <#macro renderHyperlinkField></#macro> -<#macro renderTextField name className alert value textSize maxlength id event action disabled clientAutocomplete ajaxUrl ajaxEnabled mask placeholder tabindex><@renderField value/></#macro> +<#macro renderTextField name className alert value textSize maxlength id event action disabled clientAutocomplete ajaxUrl ajaxEnabled mask placeholder tabindex readonly><@renderField value/></#macro> <#macro renderTextareaField name className alert cols rows id readonly value visualEditorEnable buttons tabindex language=""><@renderField value/></#macro> |
Free forum by Nabble | Edit this page |