You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Markus Grell <ta...@military.de> on 2012/01/23 13:29:20 UTC

Preselect radio option

Greetings!

It looks like as if I'm blind,  but i just can't find it:

How can I preselect a radio option in a radio group?

Markus


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


Re: Preselect radio option

Posted by Markus Grell <ta...@military.de>.
Ahhh, understood.

*Wow*, that was easy and works like a charm!

Thanks guys for your quick help, more questions to come ;)

Markus


> Set your "capacity" value before rendering.  You have:
>
>
> <t:radiogroup value="capacity">
>
>
> This gets/sets the value of the radio group.
>
>
> mrg
>
>
> On Mon, Jan 23, 2012 at 8:06 AM, Markus Grell <ta...@military.de>
> wrote:
>
>>> On Mon, 23 Jan 2012 10:29:20 -0200, Markus Grell
>>> <ta...@military.de>
>>> wrote:
>>>
>>>
>>>
>>>> Greetings!
>>>>
>>>>
>>>>
>>>> It looks like as if I'm blind,  but i just can't find it:
>>>>
>>>>
>>>>
>>>> How can I preselect a radio option in a radio group?
>>>>
>>>>
>>>
>>> Set the desired value to the edited property before rendering. This
>>> works  for every form field component.
>>>
>>
>>
>> Sorry, I don't get that :-(
>>
>>
>> I have the following in my template:
>>
>>
>>
>> <t:radiogroup value="capacity">
>> <t:loop source="capacityValues" value="currentCapacityElement">
>> <t:label for="radio"/>
>> <t:radio t:id="radio" value="prop:currentCapacityElement"
>> label="prop:label"/>
>> </t:loop>
>> </t:radiogroup>
>>
>>
>> In the Java file:
>>
>>
>> ...
>>        public List<Object> getCapacityValues() {
>>        return crudService.findWithNamedQuery(Capacity.ALL);
>>
>>
>>        }
>>
>>
>>        public String getLabel() {
>>                return currentLeistungElement.label;
>>        }
>> }
>> ...
>>
>>
>> The possible values for the Radio group are pulled from a database.
>> Which radio button should already be selected when the form is displayed
>>  (i.e. pre-selected) is pulled from another table. (It's a 1:n
>> relation, nut I think that doesn't matter here).
>>
>> Where do I have to do what you did suggest above?
>>
>>
>> Markus
>>
>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> 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: Preselect radio option

Posted by Michael Gentry <mg...@masslight.net>.
Hi Markus,

Set your "capacity" value before rendering.  You have:

<t:radiogroup value="capacity">

This gets/sets the value of the radio group.

mrg


On Mon, Jan 23, 2012 at 8:06 AM, Markus Grell <ta...@military.de> wrote:
>> On Mon, 23 Jan 2012 10:29:20 -0200, Markus Grell <ta...@military.de>
>> wrote:
>>
>>
>>> Greetings!
>>>
>>>
>>> It looks like as if I'm blind,  but i just can't find it:
>>>
>>>
>>> How can I preselect a radio option in a radio group?
>>>
>>
>> Set the desired value to the edited property before rendering. This works
>>  for every form field component.
>
>
> Sorry, I don't get that :-(
>
> I have the following in my template:
>
>
> <t:radiogroup value="capacity">
> <t:loop source="capacityValues" value="currentCapacityElement">
> <t:label for="radio"/>
> <t:radio t:id="radio" value="prop:currentCapacityElement"
> label="prop:label"/>
> </t:loop>
> </t:radiogroup>
>
> In the Java file:
>
> ...
>        public List<Object> getCapacityValues() {
>        return crudService.findWithNamedQuery(Capacity.ALL);
>
>        }
>
>        public String getLabel() {
>                return currentLeistungElement.label;
>        }
> }
> ...
>
> The possible values for the Radio group are pulled from a database.
> Which radio button should already be selected when the form is displayed
> (i.e. pre-selected) is pulled from another table. (It's a 1:n relation,
> nut I think that doesn't matter here).
>
> Where do I have to do what you did suggest above?
>
> Markus
>
>
>
>
> ---------------------------------------------------------------------
> 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: Preselect radio option

Posted by Markus Grell <ta...@military.de>.
> On Mon, 23 Jan 2012 10:29:20 -0200, Markus Grell <ta...@military.de>
> wrote:
>
>
>> Greetings!
>>
>>
>> It looks like as if I'm blind,  but i just can't find it:
>>
>>
>> How can I preselect a radio option in a radio group?
>>
>
> Set the desired value to the edited property before rendering. This works
>  for every form field component.


Sorry, I don't get that :-(

I have the following in my template:


<t:radiogroup value="capacity">
<t:loop source="capacityValues" value="currentCapacityElement">
<t:label for="radio"/>
<t:radio t:id="radio" value="prop:currentCapacityElement"
label="prop:label"/>
</t:loop>
</t:radiogroup>

In the Java file:

...
	public List<Object> getCapacityValues() {
        return crudService.findWithNamedQuery(Capacity.ALL);

	}

	public String getLabel() {
		return currentLeistungElement.label;
	}
}
...

The possible values for the Radio group are pulled from a database.
Which radio button should already be selected when the form is displayed
(i.e. pre-selected) is pulled from another table. (It's a 1:n relation,
nut I think that doesn't matter here).

Where do I have to do what you did suggest above?

Markus




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


Re: Preselect radio option

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
On Mon, 23 Jan 2012 10:29:20 -0200, Markus Grell <ta...@military.de>  
wrote:

> Greetings!
>
> It looks like as if I'm blind,  but i just can't find it:
>
> How can I preselect a radio option in a radio group?

Set the desired value to the edited property before rendering. This works  
for every form field component.

-- 
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,  
and instructor
Owner, Ars Machina Tecnologia da Informação Ltda.
http://www.arsmachina.com.br

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