You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@struts.apache.org by "Musachy Barroso (JIRA)" <ji...@apache.org> on 2008/11/19 20:20:36 UTC

[jira] Resolved: (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 ]

Musachy Barroso resolved WW-2238.
---------------------------------

    Resolution: Fixed

Closing this, if the tag should be removed (which I am not sure about), see my comment on how to do that.

> 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.