Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
763 posts
|
Author: jaz
Date: Mon Mar 22 17:32:25 2010 New Revision: 926207 URL: http://svn.apache.org/viewvc?rev=926207&view=rev Log: added link + javascript to clear lookup field when the text area is disabled; also clears the description field if it exists Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/MacroFormRenderer.java ofbiz/trunk/framework/widget/templates/htmlFormMacroLibrary.ftl Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/MacroFormRenderer.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/MacroFormRenderer.java?rev=926207&r1=926206&r2=926207&view=diff ============================================================================== --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/MacroFormRenderer.java (original) +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/MacroFormRenderer.java Mon Mar 22 17:32:25 2010 @@ -1992,6 +1992,14 @@ public class MacroFormRenderer implement if (UtilValidate.isEmpty(fadeBackground)){ fadeBackground = "false"; } + + String clearText = ""; + Map<String, Object> uiLabelMap = UtilGenerics.checkMap(context.get("uiLabelMap")); + if (uiLabelMap != null) { + clearText = (String) uiLabelMap.get("CommonClear"); + } else { + Debug.logWarning("Could not find uiLabelMap in context", module); + } StringWriter sr = new StringWriter(); sr.append("<@renderLookupField "); @@ -2046,6 +2054,8 @@ public class MacroFormRenderer implement sr.append(lookupPosition); sr.append("\" fadeBackground=\""); sr.append(fadeBackground); + sr.append("\" clearText=\""); + sr.append(clearText); sr.append("\" />"); executeMacro(sr.toString()); Modified: ofbiz/trunk/framework/widget/templates/htmlFormMacroLibrary.ftl URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/templates/htmlFormMacroLibrary.ftl?rev=926207&r1=926206&r2=926207&view=diff ============================================================================== --- ofbiz/trunk/framework/widget/templates/htmlFormMacroLibrary.ftl (original) +++ ofbiz/trunk/framework/widget/templates/htmlFormMacroLibrary.ftl Mon Mar 22 17:32:25 2010 @@ -431,7 +431,7 @@ ${item.description}</div> </#if> </#macro> -<#macro renderLookupField className="" alert="" name="" value="" size="20" maxlength="20" id="" event="" action="" disabled="" autocomplete="" descriptionFieldName="" formName="" lookupFieldFormName="" targetParameterIter="" imgSrc="" ajaxUrl="" ajaxEnabled="" lookupPresentation="" lookupWidth="20" lookupHeight="20" lookupPosition="20" fadeBackground=""> +<#macro renderLookupField className="" alert="" name="" value="" size="20" maxlength="20" id="" event="" action="" disabled="" autocomplete="" descriptionFieldName="" formName="" lookupFieldFormName="" targetParameterIter="" imgSrc="" ajaxUrl="" ajaxEnabled="" lookupPresentation="" lookupWidth="20" lookupHeight="20" lookupPosition="20" fadeBackground="" clearText=""> <div class="field-lookup"><ul> <#if size?has_content && size="0"><li><input type="hidden" <#if name?has_content> name="${name}"/></#if></li><#else><li><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/></li></#if> <li><#if lookupPresentation?has_content && descriptionFieldName?has_content && lookupPresentation == "layer"> @@ -451,6 +451,7 @@ ${item.description}</div> );"> <#if ajaxEnabled?has_content && ajaxEnabled><span id="${id}_indicator" style="display: none" class="indicator"><img /></span></#if> </a></li><#rt> +<#if disabled?has_content && disabled><li><a id="${id}_clear" style="background:none;margin-left:-6px;margin-right:15px;" class="clearField" href="javascript:document.${formName}.${name}.value='';<#if descriptionFieldName?has_content>document.${formName}.${descriptionFieldName}.value='';</#if>">${clearText}</a></li></#if> </ul></div> <#if ajaxEnabled?has_content && ajaxEnabled> <script language="JavaScript" type="text/javascript">ajaxAutoCompleter('${ajaxUrl}');</script><#t/> |
Free forum by Nabble | Edit this page |