You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@struts.apache.org by "James Holmes (JIRA)" <ji...@apache.org> on 2008/06/16 20:35:05 UTC

[jira] Reopened: (WW-2238) checkboxlist labels and values mixed up

     [ https://issues.apache.org/struts/browse/WW-2238?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

James Holmes reopened WW-2238:
------------------------------


Upon more thought I believe that the label attribute should be removed from this tag. It does not make sense to apply the same label to a list of checkboxes.

Anyone know how to remove attributes for a tag that is an extension of other classes? The @StrutsTagAttribute annotation for the label attribute is on the UIBean class that the CheckBoxList class ultimately extends from.

> checkboxlist labels and values mixed up
> ---------------------------------------
>
>                 Key: WW-2238
>                 URL: https://issues.apache.org/struts/browse/WW-2238
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Plugin - Tags
>    Affects Versions: 2.0.9
>            Reporter: Robert-Jan Westerhof
>            Priority: Minor
>             Fix For: 2.1.3
>
>
> The checkboxlist.ftl that ships with struts2 2.0.9 uses the listValue attribute to populate the labels. The listKey is used as the checkbox values. The label attribute is not used at all in the template. 
> The template as shipped in the template/simple directory in the struts2-core-2.0.9.jar contains the following:
> ...
>         <#if parameters.listKey?exists>
>             <#assign itemKey = stack.findValue(parameters.listKey)/>
>         <#else>
>             <#assign itemKey = stack.findValue('top')/>
>         </#if>
>         <#if parameters.listValue?exists>
>             <#assign itemValue = stack.findString(parameters.listValue)/>
>         <#else>
>             <#assign itemValue = stack.findString('top')/>
>         </#if>
> <#assign itemKeyStr=itemKey.toString() />
> <input type="checkbox" name="${parameters.name?html}" value="${itemKeyStr?html}" id="${parameters.name?html}-${itemCount}"<#rt/>
> ...
> />
> <label for="${parameters.name?html}-${itemCount}" class="checkboxLabel">${itemValue?html}</label>
> ...
> I believe this should read something like
> ...
>         <#if parameters.listKey?exists>
>             <#assign itemKey = stack.findValue(parameters.listKey)/>
>         <#else>
>             <#assign itemKey = stack.findValue('top')/>
>         </#if>
>         <#if parameters.listValue?exists>
>             <#assign itemValue = stack.findString(parameters.listValue)/>
>         <#else>
>             <#assign itemValue = stack.findString('top')/>
>         </#if>
>         <#if parameters.label?exists>
>             <#assign itemLabel = stack.findString(parameters.label)/>
>         <#else>
>             <#assign itemLabel = stack.findString('top')/>
>         </#if>
> <input type="checkbox" name="${parameters.name?html}" value="${itemValue?html}" id="${parameters.name?html}-${itemCount}"<#rt/>
> ...
> />
> <label for="${parameters.name?html}-${itemCount}" class="checkboxLabel">${itemLabel?html}</label>
> ...
> Bug priority set to minor, as there is an easy workaround by defining a custom template...

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.