[ 
http://www.stripesframework.org/jira/browse/STS-849?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12413#comment-12413
 ] 

Anthony DePalma commented on STS-849:
-------------------------------------

Yes it will work if I change my objects toString to return the id, but I can't 
do that as a solution since our toStrings are used for debugging our 
application elsewhere. But really, this is the job the typeFormatter is 
supposed to be doing, and is doing for other tags like the checkbox. Its 
probably been a subtle bug for a long time, I've seen alot of posts about 
people having difficulty with radio buttons preselecting.

> Radio Buttons do not render correctly through the tag using the 'checked' 
> attribute
> -----------------------------------------------------------------------------------
>
>                 Key: STS-849
>                 URL: http://www.stripesframework.org/jira/browse/STS-849
>             Project: Stripes
>          Issue Type: Bug
>          Components: Tag Library
>    Affects Versions: Release 1.5.6
>            Reporter: Anthony DePalma
>              Labels: binding, taglib
>
> I am using a custom population strategy that looks only in the request first 
> and then for values in the tag itself. I've noticed that the checked 
> attribute does not work for radio buttons if the value is a non-primitive 
> object. 
> For example, using an example Story and Category object:
> Story
>  Long id;
>  Boolean approved;
>  Category category;
> Category
>  Long id;
>  String name ;
> The following tags work correctly with the checked attribute preselecting for 
> both radio buttons and checkboxes:
> <stripes:checkbox checked="${actionBean.story.approved}"  
> name="story.approved" value="true"/> 
> <stripes:radio        checked="${actionBean.story.approved}"  
> name="story.approved" value="true"/> 
> However, using a non primitive object such as category, of the following 
> similar tags, only the checkbox tag works correctly:
> <stripes:checkbox checked="${actionBean.story.category}"  
> name="story.category" value="${actionBean.healthCategory}"/> 
> <stripes:radio        checked="${actionBean.story.category}"  
> name="story.category" value="${actionBean.healthCategory}"/> 
> I believe the reason for this is because the checked field in the 
> InputRadioButtonTag.class is declared as a 'String checked' field. The 
> checked attribute in the InputCheckboxTag.class on the other hand uses an 
> 'Object checked' field. In the InputRadioButtonTag, the checked field is 
> stored as the toString value of the object, instead of calling the object's 
> custom converter, so the checked value never matches the value provided in 
> the tag.

-- 
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure contains a
definitive record of customers, application performance, security
threats, fraudulent activity and more. Splunk takes this data and makes
sense of it. Business sense. IT sense. Common sense.
http://p.sf.net/sfu/splunk-d2dcopy1
_______________________________________________
Stripes-development mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-development

Reply via email to