struts-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "James Holmes (JIRA)" <j...@apache.org>
Subject [jira] Resolved: (WW-2238) checkboxlist labels and values mixed up
Date Sat, 14 Jun 2008 20:48:05 GMT

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

James Holmes resolved WW-2238.
------------------------------

    Resolution: Fixed

Fixed in SVN revision 667876.

Note that I implemented this slightly different than you proposed.  The old behavior was putting
the checkbox's value as the label and will continue to do that unless the label attribute
is specified. The problem with using a label attribute with this tag is that say you have
5 items in a list, all 5 would get the same label. I'm not sure what purpose that would serve,
but the template will now allow you to do that if you so desire.

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


Mime
View raw message