History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: WW-1297
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Minor Minor
Assignee: Rainer Hermanns
Reporter: Hugh Lang
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
WebWork

radiomap.ftl formats long numbers with commas

Created: 11/Jun/06 01:16 PM   Updated: 19/May/07 08:43 PM
Component/s: Views
Affects Version/s: 2.2.2
Fix Version/s: 2.2.3

Environment: Java 5, OS X, Tomcat 5

Flags: Important


 Description  « Hide
I encountered a problem when using the ww:radio tag and populating it with a List. Example:

<ww:radio label="Choose one" name="choiceId" list="%{topic.choices}"
listKey="id" listValue="name" />

In the resulting html, the "id" was getting messed up. Long numbers of 4 digits or longer had an embedded comma. Like this:

<input type="radio" name="choiceId" id="viewForm_choiceId1,002" value="1,002"/><label for="viewForm_choiceId1,002">Burritoville</label>

Fortunately I found the problem and fixed it. (see below)


 All   Comments   Change History      Sort Order:
Hugh Lang - [11/Jun/06 01:20 PM ]
Below is a copy of my modified radiomap.ftl that fixes the problem. Basically I looked at select.ftl and found out that it was creating a variable for itemKeyStr using the value of itemKey.toString(). I did the same with radiomap.ftl and used the itemKeyStr variable in three places.

Since the webwork.jar contains all of the freemarker templates, you need to put this in your webapp in /template/simple to override the one in the jar.


<@ww.iterator value="parameters.list">
    <#if parameters.listKey?exists>
        <#assign itemKey = stack.findValue(parameters.listKey)/>
    <#else>
        <#assign itemKey = stack.findValue('top')/>
    </#if>
    <#assign itemKeyStr = itemKey.toString() />
    <#if parameters.listValue?exists>
        <#assign itemValue = stack.findString(parameters.listValue)/>
    <#else>
        <#assign itemValue = stack.findString('top')/>
    </#if>
<input type="radio" name="${parameters.name?html}" id="${parameters.id?html}${itemKeyStr?html}"<#rt/>
<#if tag.contains(parameters.nameValue, itemKey)>
 checked="checked"<#rt/>
</#if>
<#if itemKey?exists>
 value="${itemKeyStr?html}"<#rt/>
</#if>
<#if parameters.disabled?default(false)>
 disabled="disabled"<#rt/>
</#if>
<#if parameters.tabindex?exists>
 tabindex="${parameters.tabindex?html}"<#rt/>
</#if>
<#if parameters.cssClass?exists>
 class="${parameters.cssClass?html}"<#rt/>
</#if>
<#if parameters.cssStyle?exists>
 style="${parameters.cssStyle?html}"<#rt/>
</#if>
<#if parameters.title?exists>
 title="${parameters.title?html}"<#rt/>
</#if>
<#include "/${parameters.templateDir}/simple/scripting-events.ftl" />
/><#rt/>
<label for="${parameters.id?html}${itemKeyStr?html}"><#rt/>
    ${itemValue}<#t/>
</label>
</@ww.iterator>

Rainer Hermanns - [26/Jun/06 03:29 PM ]
Thanks, patch applied