FYI, Created an issue in the JIRA for this :
https://issues.apache.org/jira/browse/WW-3569
<https://issues.apache.org/jira/browse/WW-3569>

On Mon, Feb 7, 2011 at 8:47 PM, John Dondapati <djohnji...@gmail.com> wrote:

> Hello,
>
>  If you are breaking your head like me to see why the appropriate radio
> button is not selected, this might help you. FYI, I am using the simple
> theme.
>
> My s:radio tag  :
>                         <s:radio id="answers[%{#question.id}]"
> name="answers[%{#question.id}]"
>                                  list="options"  listKey="questionOptionId"
>  listValue="optionText" *value*="answers[%{#question.id}]"   />
>
> Note: answers is a HashMap<Integer, String>
>
> 1. Create a new theme. Read more 
> here<http://siriwardana.blogspot.com/2008/11/vertically-formatted-checkboxlist.html>
>  if
> you don't know how.
> 2. Make the following changes to the radiomap.ftl (I am only showing the
> part that you need to fix and not the entire file).
> -------------------------------------------------------
> <#if parameters.name??>
> *<#--/*ADD THIS LINE*/-->*
> *        <#assign nameValue = stack.findString(parameters.name)/> *
>  name="${parameters.name?html}" nmv="${nameValue?html} <#rt/>
> </#if>
>  
> id="${parameters.id?html}${itemKeyStr?html<http://parameters.id?html%7D$%7BitemKeyStr?html>}"
> <#rt/>
> *<#--/*REMOVE THIS LINE*/-->*
> *<#if tag.contains(parameters.nameValue?default(''), itemKeyStr)> *
> *<#--/*ADD THIS LINE*/-->*
> *<#if tag.contains(nameValue, itemKeyStr) == true> *
>  checked="checked" <#rt/>
> </#if>
> -------------------------------------------------------
>
> *The problem *
>
> I am not an expert on freemarker but I guess the *nameValue *parameter is
> missing here (which is not in the documentation) and since it cannot find
> that parameter it defaults to empty string and hence it will never match the
> itemKeyStr unless the listKey is null or empty for that list item.
>
> *The Solution*
>  Just assign a *nameValue *variable to take the value from the value stack
> using the el expression you passed as it's parameter value. And use the
> tag.contains() method to compare it against the current list item's key
> which is stored in the itemKeyStr. That should work.
>
> If I am doing this right, how do we get this fix in the next patch? Please
> advise. Thanks!
>
> --
> Cheers,
> John
>
>


-- 
Cheers,
John

Reply via email to