Hi

You should also use the clientId instead :

Inherit previx can be used to inherit a specific parameter from the outer
component.

 <t:radiogroup t:id="id" t:clientId="inherit:clientId" value="stringValue"
encoder="stringEncoder">

And your YesNoRadio

@Parameter
private String clientId;

Regards,
Christophe

2009/10/9 ross.efi <[email protected]>

>
> I'm trying to make a little reusable component to remove a bunch of cut and
> paste.  It uses a radio group for Yes and No and uses a boolean for the
> value.  I want to use it like this:
>
>                <tr>
>                    <th><t:label for="someAttribute"/></th>
>                    <td><t:yesnoradio t:id="someAttribute"
> value="myObject.isYesNo"/></td>
>                </tr>
>
> Here's what I have:
>
> YesNoRadio.tml:
>
> <t:container xmlns:t="http://tapestry.apache.org/schema/tapestry_5_1_0.xsd
> ">
>    <t:radiogroup t:id="id" value="stringValue" encoder="stringEncoder">
>        <t:radio t:id="idForY" value="literal:true" label="Yes"/><t:label
> for="idForY"/>
>        <t:radio t:id="idForN" value="literal:false" label="No"/><t:label
> for="idForN"/>
>    </t:radiogroup>
> </t:container>
>
> YesNoRadio.java
>
> public class YesNoRadio {
>
>    @Parameter
>    private String _id;
>
>    @Parameter
>    private boolean _value;
>
>    @Property
>    private String _stringValue;
>
>    @Property
>    private StringValueEncoder _stringEncoder = new StringValueEncoder();
>
>    void onSuccess() {
>        _value = Boolean.valueOf( _stringValue );
>    }
>
>    void onPrepare() {
>        _stringValue = String.valueOf( _value );
>    }
> }
>
> I can't seem to get the id to work correctly - I just want to pass it down
> to the underlying radiogroup.  This component will appear more than once on
> a page, so I want each use to have an id that each label can use.
>
> Will the component get notified by the form using onPrepare and onSuccess?
> I need to convert the value boolean into a string for the radios to work
> with.
>
> Am I on the right track?
>
> Ross
> --
> View this message in context:
> http://www.nabble.com/Reusable-YesNoRadio-component-tp25821019p25821019.html
> Sent from the Tapestry - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>

Reply via email to