You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by David Siedlecki <da...@beatsystems.com> on 2013/04/05 11:02:14 UTC

binding an enum to a radio group

Hi there. I found this example on how to bind an enum to a radio group in tapestry...

http://lombok.demon.co.uk/tapestry5Demo/test/radio/onesource

Is there a quicker way to do this without having to loop round every single value?


It seems to be so much easier to bind an enum to a select. When I've done this with a select all I had to do was this...


<select name="enumProperty" t:type="Select" t:id="enumProperty"></select>

Just one line and it binds my enum in the page class and populates all the select options (it even guesses the display value to use).
Which is really neat.

Isn't it possible to something similar with radio groups without having to resort to creating a loop to go round each option?

Eg.. something like this?

<t:radiogroup t:id="enumProperty"></t:radiogroup>


Many thanks,

David

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: binding an enum to a radio group

Posted by Bob Harner <bo...@gmail.com>.
No, Tapestry doesn't have a single component that will generate a list
of radio buttons. There is a "checklist" component, but no
corresponding "radiolist". But even if something like a radiolist
component existed, it might not be quite what you'd want. That's
because, unlike a select element, HTML radio buttons don't have a
pre-determined layout. You'll need to decide whether you want them
arranged horizontally or vertically, whether the label should be on
the left side or right, whether the radio buttons and labels should be
in separate cells of a table, etc.

On Fri, Apr 5, 2013 at 5:02 AM, David Siedlecki
<da...@beatsystems.com> wrote:
> Hi there. I found this example on how to bind an enum to a radio group in tapestry...
>
> http://lombok.demon.co.uk/tapestry5Demo/test/radio/onesource
>
> Is there a quicker way to do this without having to loop round every single value?
>
>
> It seems to be so much easier to bind an enum to a select. When I've done this with a select all I had to do was this...
>
>
> <select name="enumProperty" t:type="Select" t:id="enumProperty"></select>
>
> Just one line and it binds my enum in the page class and populates all the select options (it even guesses the display value to use).
> Which is really neat.
>
> Isn't it possible to something similar with radio groups without having to resort to creating a loop to go round each option?
>
> Eg.. something like this?
>
> <t:radiogroup t:id="enumProperty"></t:radiogroup>
>
>
> Many thanks,
>
> David
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org