Author: ashish
Date: Sat Apr 30 09:07:51 2011 New Revision: 1098087 URL: http://svn.apache.org/viewvc?rev=1098087&view=rev Log: Bug fix(Hand merged changes from trunk r1098082). Applied patch from jira issue OFBIZ-4267. Disabled attribute for lookup field should be readonly. Lookup tag has a attribute "disabled" that is used to set disabled="disabled" property for lookup input element and it create also a clear button just after lookup field to clear the field value. But if we set disabled="disabled" for any input field then that field does not passes as parameter and we can't accesses it from parameters or request parameters , so it should be "readonly". If we set readonly-"readonly" then user can't change the field value directly, and this field passes as parameters. Only difference between readonly and disabled is that in case of disabled field does not passes as parameter buy in case of readonly field passes as a parameter. Thanks Deepak for the contribution. Modified: ofbiz/branches/release10.04/framework/widget/dtd/widget-form.xsd ofbiz/branches/release10.04/framework/widget/src/org/ofbiz/widget/form/MacroFormRenderer.java ofbiz/branches/release10.04/framework/widget/src/org/ofbiz/widget/form/ModelFormField.java ofbiz/branches/release10.04/framework/widget/templates/htmlFormMacroLibrary.ftl Modified: ofbiz/branches/release10.04/framework/widget/dtd/widget-form.xsd URL: http://svn.apache.org/viewvc/ofbiz/branches/release10.04/framework/widget/dtd/widget-form.xsd?rev=1098087&r1=1098086&r2=1098087&view=diff ============================================================================== --- ofbiz/branches/release10.04/framework/widget/dtd/widget-form.xsd (original) +++ ofbiz/branches/release10.04/framework/widget/dtd/widget-form.xsd Sat Apr 30 09:07:51 2011 @@ -917,7 +917,7 @@ under the License. </xs:restriction> </xs:simpleType> </xs:attribute> - <xs:attribute name="disabled" default="false"> + <xs:attribute name="read-only" default="false"> <xs:simpleType> <xs:restriction base="xs:token"> <xs:enumeration value="true"/> Modified: ofbiz/branches/release10.04/framework/widget/src/org/ofbiz/widget/form/MacroFormRenderer.java URL: http://svn.apache.org/viewvc/ofbiz/branches/release10.04/framework/widget/src/org/ofbiz/widget/form/MacroFormRenderer.java?rev=1098087&r1=1098086&r2=1098087&view=diff ============================================================================== --- ofbiz/branches/release10.04/framework/widget/src/org/ofbiz/widget/form/MacroFormRenderer.java (original) +++ ofbiz/branches/release10.04/framework/widget/src/org/ofbiz/widget/form/MacroFormRenderer.java Sat Apr 30 09:07:51 2011 @@ -1965,7 +1965,7 @@ public class MacroFormRenderer implement String event = modelFormField.getEvent(); String action = modelFormField.getAction(context); - boolean disabled = lookupField.disabled; + boolean readonly = lookupField.readonly; // add lookup pop-up button String descriptionFieldName = lookupField.getDescriptionFieldName(); @@ -2051,8 +2051,8 @@ public class MacroFormRenderer implement if (action != null) { sr.append(action); } - sr.append("\" disabled="); - sr.append(Boolean.toString(disabled)); + sr.append("\" readonly="); + sr.append(Boolean.toString(readonly)); sr.append(" autocomplete=\""); sr.append(autocomplete); Modified: ofbiz/branches/release10.04/framework/widget/src/org/ofbiz/widget/form/ModelFormField.java URL: http://svn.apache.org/viewvc/ofbiz/branches/release10.04/framework/widget/src/org/ofbiz/widget/form/ModelFormField.java?rev=1098087&r1=1098086&r2=1098087&view=diff ============================================================================== --- ofbiz/branches/release10.04/framework/widget/src/org/ofbiz/widget/form/ModelFormField.java (original) +++ ofbiz/branches/release10.04/framework/widget/src/org/ofbiz/widget/form/ModelFormField.java Sat Apr 30 09:07:51 2011 @@ -2736,6 +2736,7 @@ public class ModelFormField { protected FlexibleStringExpander defaultValue; protected SubHyperlink subHyperlink; protected boolean disabled; + protected boolean readonly; protected boolean clientAutocompleteField; protected TextField() { @@ -2774,6 +2775,7 @@ public class ModelFormField { } this.disabled = "true".equals(element.getAttribute("disabled")); + this.readonly = "true".equals(element.getAttribute("read-only")); this.clientAutocompleteField = !"false".equals(element.getAttribute("client-autocomplete-field")); @@ -2804,6 +2806,15 @@ public class ModelFormField { this.disabled = b; } + public boolean getReadonly() { + return this.disabled; + } + + public void setReadonly(boolean b) { + this.readonly = b; + } + + public boolean getClientAutocompleteField() { return this.clientAutocompleteField; } Modified: ofbiz/branches/release10.04/framework/widget/templates/htmlFormMacroLibrary.ftl URL: http://svn.apache.org/viewvc/ofbiz/branches/release10.04/framework/widget/templates/htmlFormMacroLibrary.ftl?rev=1098087&r1=1098086&r2=1098087&view=diff ============================================================================== --- ofbiz/branches/release10.04/framework/widget/templates/htmlFormMacroLibrary.ftl (original) +++ ofbiz/branches/release10.04/framework/widget/templates/htmlFormMacroLibrary.ftl Sat Apr 30 09:07:51 2011 @@ -431,9 +431,9 @@ ${item.description}</span> </#if> </#macro> -<#macro renderLookupField className alert name value size maxlength id event action disabled autocomplete descriptionFieldName formName fieldFormName targetParameterIter imgSrc ajaxUrl ajaxEnabled presentation width height position fadeBackground clearText showDescription> +<#macro renderLookupField className alert name value size maxlength id event action readonly autocomplete descriptionFieldName formName fieldFormName targetParameterIter imgSrc ajaxUrl ajaxEnabled presentation width height position fadeBackground clearText showDescription> <span class="field-lookup"> -<#if size?has_content && size=="0"><input type="hidden" <#if name?has_content> name="${name}"/></#if><#else><input type="text" <@renderClass className alert /><#if name?has_content> name="${name}"</#if><#if value?has_content> value="${value}"</#if><#if size?has_content> size="${size}"</#if><#if maxlength?has_content> maxlength="${maxlength}"</#if><#if id?has_content> id="${id}"</#if><#rt/><#if disabled?has_content && disabled> disabled="disabled"</#if><#rt/><#if event?has_content && action?has_content> ${event}="${action}"</#if><#rt/><#if autocomplete?has_content> autocomplete="off"</#if>/><#rt/></#if> +<#if size?has_content && size=="0"><input type="hidden" <#if name?has_content> name="${name}"/></#if><#else><input type="text" <@renderClass className alert /><#if name?has_content> name="${name}"</#if><#if value?has_content> value="${value}"</#if><#if size?has_content> size="${size}"</#if><#if maxlength?has_content> maxlength="${maxlength}"</#if><#if id?has_content> id="${id}"</#if><#rt/><#if readonly?has_content && readonly> readonly="readonly"</#if><#rt/><#if event?has_content && action?has_content> ${event}="${action}"</#if><#rt/><#if autocomplete?has_content> autocomplete="off"</#if>/><#rt/></#if> <#if presentation?has_content && descriptionFieldName?has_content && presentation == "window"> <a href="javascript:call_fieldlookup3(document.${formName?html}.${name?html},document.${formName?html}.${descriptionFieldName},'${fieldFormName}'<#rt/> <#elseif presentation?has_content && presentation == "window"> @@ -451,7 +451,7 @@ ${item.description}</span> );"> <#if ajaxEnabled?has_content && ajaxEnabled><span id="${id}_indicator" style="display: none" class="indicator"><img src="/images/ajax-loader.gif" alt=""/></span></#if> </a><#rt> -<#if disabled?has_content && disabled><a id="${id}_clear" style="background:none;margin-left:5px;margin-right:15px;" class="clearField" href="javascript:void();" onclick="javascript:document.${formName}.${name}.value='';<#if descriptionFieldName?has_content>document.${formName}.${descriptionFieldName}.value='';</#if>">${clearText}</a></#if> +<#if readonly?has_content && readonly><a id="${id}_clear" style="background:none;margin-left:5px;margin-right:15px;" class="clearField" href="javascript:void();" onclick="javascript:document.${formName}.${name}.value='';<#if descriptionFieldName?has_content>document.${formName}.${descriptionFieldName}.value='';</#if>">${clearText}</a></#if> </span> <#if ajaxEnabled?has_content && ajaxEnabled> <#if parameters?has_content && parameters._LAST_VIEW_NAME_?has_content> |
Free forum by Nabble | Edit this page |