Yes, I suppose I could do that, though the nice thing about having "null" be the "NONE" choice is that I don't have to do any special initializing in the action.
Thanks for the confirmation that I'm not crazy. On Thu, Dec 3, 2009 at 9:36 AM, Nathan Maves <[email protected]> wrote: > This issue has pissed me off too many times to count. There is another way > around it if you choose. You can also add another choice to your enum like > Choice.NONE and it will select it. I usually end up doing like you with a > classic html input and setting the checked value on my own. This way I dont > have to decode it in an action. I agree that this should be a fixable > issue. > Nathan > > On Tue, Dec 1, 2009 at 11:02 PM, Mike McNally <[email protected]> wrote: >> >> I've probably asked this before, but the information refuses to stick >> to my brain. >> >> This pattern comes up a lot for me: I have an action bean for a form, >> and part of the form is a set of radio buttons corresponding to an >> enum for some modal behavior (say, an item type filter selector for a >> "query" action). The default setting for the radio buttons should be >> the "Any" or "Don't Care" option, which corresponds to an empty value >> - a null for the enum reference in the action bean, in other words. >> >> When I submit the form, the empty value for the "Don't Care" radio >> button does what I want: the action bean gets a null enum reference, >> so the query operation proceeds without including any filter for the >> item type. If another radio button is selected, then the field is >> correctly populated and things work fine. >> >> The problem comes up in the initial population of the form. The "Don't >> Care" radio button is given "value = ''" and "checked = 'true'" >> attributes, but Stripes leaves all the radio buttons unchecked. The >> action bean has no value for the enum property, but for some reason >> Stripes doesn't relate that empty value to the empty value on the >> default radio button. >> >> So my question is, why is that? It's easy enough to work around by >> coding up a non-Stripes <input type='radio' ...> element, but I don't >> understand what the "greater good" is from Stripes not deciding that >> the null enum value should correspond to the radio button with the >> empty value attribute, since that's exactly how things will be bound >> in the other direction. >> >> >> -- >> Turtle, turtle, on the ground, >> Pink and shiny, turn around. >> >> >> ------------------------------------------------------------------------------ >> Join us December 9, 2009 for the Red Hat Virtual Experience, >> a free event focused on virtualization and cloud computing. >> Attend in-depth sessions from your desk. Your couch. Anywhere. >> http://p.sf.net/sfu/redhat-sfdev2dev >> _______________________________________________ >> Stripes-users mailing list >> [email protected] >> https://lists.sourceforge.net/lists/listinfo/stripes-users > > > ------------------------------------------------------------------------------ > Join us December 9, 2009 for the Red Hat Virtual Experience, > a free event focused on virtualization and cloud computing. > Attend in-depth sessions from your desk. Your couch. Anywhere. > http://p.sf.net/sfu/redhat-sfdev2dev > _______________________________________________ > Stripes-users mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/stripes-users > > -- Turtle, turtle, on the ground, Pink and shiny, turn around. ------------------------------------------------------------------------------ Join us December 9, 2009 for the Red Hat Virtual Experience, a free event focused on virtualization and cloud computing. Attend in-depth sessions from your desk. Your couch. Anywhere. http://p.sf.net/sfu/redhat-sfdev2dev _______________________________________________ Stripes-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/stripes-users
