
|
If you were logged in you would be able to see more operations.
|
|
|
WebWork
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
|
|
|
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)
|
|
Description
|
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)
|
Show » |
|
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>