Author: jonesde Date: Tue Sep 21 21:55:16 2010 New Revision: 999663 URL: http://svn.apache.org/viewvc?rev=999663&view=rev Log: For form widget checkbox fields the id is now generated in the HTML for the first checkbox; this is mostly useful for single checkbox fields such as when using a checkbox instead of a Y/N drop-down
Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/MacroFormRenderer.java ofbiz/trunk/framework/widget/templates/csvFormMacroLibrary.ftl 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/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=999663&r1=999662&r2=999663&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 Tue Sep 21 21:55:16 2010 @@ -938,6 +938,7 @@ public class MacroFormRenderer implement ModelForm modelForm = modelFormField.getModelForm(); String currentValue = modelFormField.getEntry(context); Boolean allChecked = checkField.isAllChecked(context); + String id = modelFormField.getCurrentContainerId(context); String className = ""; String alert = "false"; String name = modelFormField.getParameterName(context); @@ -972,6 +973,8 @@ public class MacroFormRenderer implement sr.append(className); sr.append("\" alert=\""); sr.append(alert); + sr.append("\" id=\""); + sr.append(id); sr.append("\" allChecked="); sr.append((allChecked != null? Boolean.toString(allChecked): "\"\"")); sr.append(" currentValue=\""); Modified: ofbiz/trunk/framework/widget/templates/csvFormMacroLibrary.ftl URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/templates/csvFormMacroLibrary.ftl?rev=999663&r1=999662&r2=999663&view=diff ============================================================================== --- ofbiz/trunk/framework/widget/templates/csvFormMacroLibrary.ftl (original) +++ ofbiz/trunk/framework/widget/templates/csvFormMacroLibrary.ftl Tue Sep 21 21:55:16 2010 @@ -41,7 +41,7 @@ under the License. </#macro> <#macro renderTooltip tooltip tooltipStyle></#macro> -<#macro renderCheckField items className alert allChecked currentValue name event action></#macro> +<#macro renderCheckField items className alert id allChecked currentValue name event action></#macro> <#macro renderRadioField items className alert currentValue noCurrentSelectedKey name event ation></#macro> <#macro renderSubmitField buttonType className alert formName title name event action imgSrc confirmation containerId ajaxUrl></#macro> Modified: ofbiz/trunk/framework/widget/templates/foFormMacroLibrary.ftl URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/templates/foFormMacroLibrary.ftl?rev=999663&r1=999662&r2=999663&view=diff ============================================================================== --- ofbiz/trunk/framework/widget/templates/foFormMacroLibrary.ftl (original) +++ ofbiz/trunk/framework/widget/templates/foFormMacroLibrary.ftl Tue Sep 21 21:55:16 2010 @@ -64,7 +64,7 @@ under the License. </#if> </#macro> -<#macro renderCheckField items className alert allChecked currentValue name event action><@makeBlock "" "" /></#macro> +<#macro renderCheckField items className alert id allChecked currentValue name event action><@makeBlock "" "" /></#macro> <#macro renderRadioField items className alert currentValue noCurrentSelectedKey name event ation><@makeBlock "" "" /></#macro> <#macro renderSubmitField buttonType className alert formName title name event action imgSrc confirmation containerId ajaxUrl><@makeBlock "" "" /></#macro> Modified: ofbiz/trunk/framework/widget/templates/htmlFormMacroLibrary.ftl URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/templates/htmlFormMacroLibrary.ftl?rev=999663&r1=999662&r2=999663&view=diff ============================================================================== --- ofbiz/trunk/framework/widget/templates/htmlFormMacroLibrary.ftl (original) +++ ofbiz/trunk/framework/widget/templates/htmlFormMacroLibrary.ftl Tue Sep 21 21:55:16 2010 @@ -170,9 +170,9 @@ if(disa && document.styleSheets) </#if> </#macro> -<#macro renderCheckField items className alert allChecked currentValue name event action> +<#macro renderCheckField items className alert id allChecked currentValue name event action> <#list items as item> -<input type="checkbox" <@renderClass className alert /><#rt/> +<input type="checkbox"<#if (item_index == 0)> id="${id}"</#if> <@renderClass className alert /><#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/> ${item.description?default("")} </#list> Modified: ofbiz/trunk/framework/widget/templates/textFormMacroLibrary.ftl URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/templates/textFormMacroLibrary.ftl?rev=999663&r1=999662&r2=999663&view=diff ============================================================================== --- ofbiz/trunk/framework/widget/templates/textFormMacroLibrary.ftl (original) +++ ofbiz/trunk/framework/widget/templates/textFormMacroLibrary.ftl Tue Sep 21 21:55:16 2010 @@ -41,7 +41,7 @@ under the License. </#macro> <#macro renderTooltip tooltip tooltipStyle></#macro> -<#macro renderCheckField items className alert allChecked currentValue name event action></#macro> +<#macro renderCheckField items className alert id allChecked currentValue name event action></#macro> <#macro renderRadioField items className alert currentValue noCurrentSelectedKey name event ation></#macro> <#macro renderSubmitField buttonType className alert formName title name event action imgSrc confirmation containerId ajaxUrl></#macro> Modified: ofbiz/trunk/framework/widget/templates/xmlFormMacroLibrary.ftl URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/templates/xmlFormMacroLibrary.ftl?rev=999663&r1=999662&r2=999663&view=diff ============================================================================== --- ofbiz/trunk/framework/widget/templates/xmlFormMacroLibrary.ftl (original) +++ ofbiz/trunk/framework/widget/templates/xmlFormMacroLibrary.ftl Tue Sep 21 21:55:16 2010 @@ -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> </#macro> -<#macro renderCheckField items className alert allChecked currentValue name event action></#macro> +<#macro renderCheckField items className alert id allChecked currentValue name event action></#macro> <#macro renderRadioField items className alert currentValue noCurrentSelectedKey name event action></#macro> <#macro renderSubmitField buttonType className alert formName title name event action imgSrc confirmation containerId ajaxUrl></#macro>