You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Christian Mittendorf <ch...@freenet.de> on 2006/06/07 18:35:39 UTC

Select first item of RadioGroup with n Radio Buttons

Hello!

I'm currently working on a RadioGroup which includes 1, 2 or 3  
RadioButtons.  The decision which Buttons will be shown is done at  
runtime. However, I'd like to select the first visible button of this  
group as the default selection.

Can anybody give me a hint on how I could solve this problem?

I've tried to use the pageBeginRender or renderComponent methods of  
the component embedding the RadioGroup. But that didn't solve my  
problem. The selection binding of the RadioGroup was set to my chosen  
default value, but the at that moment the RadioButtons have already  
been rendered and therefore no Button was selected.

Christian

P.S. JavaScript is a solution - I know - but I'd like to solve it  
without it ;-)

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


Re: Select first item of RadioGroup with n Radio Buttons

Posted by Christian Mittendorf <ch...@freenet.de>.
Hi!

Am 08.06.2006 um 04:16 schrieb Nick Westgate:

>> I've tried to use the pageBeginRender
>
> That should work. Perhaps time to post some code ...

Well, not necessary any more... sometimes it's quite helpful to
take a break and have a closer look at what you've done...

Using pageBeginRender is definitely the right way to do it.

Thanks anyway ;-)

Christian

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


Re: Select first item of RadioGroup with n Radio Buttons

Posted by Nick Westgate <ni...@key-planning.co.jp>.
Hi Christian.

> I've tried to use the pageBeginRender

That should work. Perhaps time to post some code ...

Cheers,
Nick.

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


Re: Select first item of RadioGroup with n Radio Buttons

Posted by Phillip Rhodes <sp...@rhoderunner.com>.
The way that I would do this is to bind your property to a persistent page
property and just set that property before you call page.activate


MarriedQuestion mq = new MarriedQuestion();
mq.setAnswer("No);
QuestionPage qp = (QuestionPage) cycle.getPage("QuestionPage");
qp.setMarriedQuestion(mq);
cycle.activate(qp);

in your template:
 <span jwcid="married@RadioGroup"
selected="ognl:page.marriedQuestion.answer" displayName="Married?"
validators="validators:required">
  <input type="radio" jwcid="@Radio" value="No"/> No
  <input type="radio" jwcid="@Radio" value="Yes"/> Yes
  <input type="radio" jwcid="@Radio" value="Maybe"/> Maybe
 </span>


> Am 07.06.2006 um 19:34 schrieb Phillip Rhodes:
>
>> I think that your radio group is bound to a property, in which
>> case, can
>> you just set your property and the radio group would automatically
>> reflect
>> this when it is rendered?
>
> Yes, I bound the select option to a property and I want to set this
> property to a default value that my application logic can determine
> before the component is rendered. But my question is: when do I
> set this value?In what method do I have to set this value so that the
> RadioButtons within the RadioGroup can see the value of the
> select property of the RadioGroup?
>
> Christian
>
>
>>
>>> Hello!
>>>
>>> I'm currently working on a RadioGroup which includes 1, 2 or 3
>>> RadioButtons.  The decision which Buttons will be shown is done at
>>> runtime. However, I'd like to select the first visible button of this
>>> group as the default selection.
>>>
>>> Can anybody give me a hint on how I could solve this problem?
>>>
>>> I've tried to use the pageBeginRender or renderComponent methods of
>>> the component embedding the RadioGroup. But that didn't solve my
>>> problem. The selection binding of the RadioGroup was set to my chosen
>>> default value, but the at that moment the RadioButtons have already
>>> been rendered and therefore no Button was selected.
>>>
>>> Christian
>>>
>>> P.S. JavaScript is a solution - I know - but I'd like to solve it
>>> without it ;-)
>>>
>>> ---------------------------------------------------------------------
>>> 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
>>
>
>
> ---------------------------------------------------------------------
> 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


Re: Select first item of RadioGroup with n Radio Buttons

Posted by Christian Mittendorf <ch...@freenet.de>.
Am 07.06.2006 um 19:34 schrieb Phillip Rhodes:

> I think that your radio group is bound to a property, in which  
> case, can
> you just set your property and the radio group would automatically  
> reflect
> this when it is rendered?

Yes, I bound the select option to a property and I want to set this
property to a default value that my application logic can determine
before the component is rendered. But my question is: when do I
set this value?In what method do I have to set this value so that the
RadioButtons within the RadioGroup can see the value of the
select property of the RadioGroup?

Christian


>
>> Hello!
>>
>> I'm currently working on a RadioGroup which includes 1, 2 or 3
>> RadioButtons.  The decision which Buttons will be shown is done at
>> runtime. However, I'd like to select the first visible button of this
>> group as the default selection.
>>
>> Can anybody give me a hint on how I could solve this problem?
>>
>> I've tried to use the pageBeginRender or renderComponent methods of
>> the component embedding the RadioGroup. But that didn't solve my
>> problem. The selection binding of the RadioGroup was set to my chosen
>> default value, but the at that moment the RadioButtons have already
>> been rendered and therefore no Button was selected.
>>
>> Christian
>>
>> P.S. JavaScript is a solution - I know - but I'd like to solve it
>> without it ;-)
>>
>> ---------------------------------------------------------------------
>> 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
>


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


Re: Select first item of RadioGroup with n Radio Buttons

Posted by Phillip Rhodes <sp...@rhoderunner.com>.
I think that your radio group is bound to a property, in which case, can
you just set your property and the radio group would automatically reflect
this when it is rendered?






> Hello!
>
> I'm currently working on a RadioGroup which includes 1, 2 or 3
> RadioButtons.  The decision which Buttons will be shown is done at
> runtime. However, I'd like to select the first visible button of this
> group as the default selection.
>
> Can anybody give me a hint on how I could solve this problem?
>
> I've tried to use the pageBeginRender or renderComponent methods of
> the component embedding the RadioGroup. But that didn't solve my
> problem. The selection binding of the RadioGroup was set to my chosen
> default value, but the at that moment the RadioButtons have already
> been rendered and therefore no Button was selected.
>
> Christian
>
> P.S. JavaScript is a solution - I know - but I'd like to solve it
> without it ;-)
>
> ---------------------------------------------------------------------
> 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