Thanks Josh for the issue.
I'm a bit puzzled with the comment "Returns null; the radio group does
not render as a tag and so doesn't have an id to share".
For me, a radiogroup can be replaced by a select and vice versa so the
both should be able to have a label. Wouldn't it be possible for a
radiogroup to render a simple div as a tag with its id to share ?
Stephane
Josh Canfield a écrit :
Hi Stephane,
Looking at the source, the label's id is generated like this:
String fieldId = field.getClientId();
_labelElement.forceAttributes("for", fieldId, "id",
fieldId + ":label");
If you look at the source for radiogroup you'll see that it is
intentionally returning null for the clientId.
/**
* Returns null; the radio group does not render as a tag and so
doesn't have an id to share. RadioGroup implements
* [EMAIL PROTECTED] org.apache.tapestry.Field} only so it can interact with
the [EMAIL PROTECTED] org.apache.tapestry.ValidationTracker}.
*
* @return null
*/
public String getClientId()
{
return null;
}
Adding two radiogroups with labels in the page results in label nodes
with duplicate id attributes.
I've filed the issue here: https://issues.apache.org/jira/browse/TAPESTRY-2255
Josh
On Thu, Mar 13, 2008 at 1:50 AM, Stephane Decleire
<[EMAIL PROTECTED]> wrote:
I forgot to say that i see this behavior on Tap 5.0.11 (i have not try
on previous versions)
Stephane
Stephane Decleire a écrit :
I keep on with my conversation alone ...
... and i have just tried to test the code from Tapestry
documentation
http://tapestry.apache.org/tapestry5/tapestry-core/ref/org/apache/tapestry/corelib/components/Radio.html
and get the same result : the label of the radiogroup is not displayed
(<label id="null:label"></label>)
Has anybody encounter the same behavior ?
Should i create a ticket in Jira ?
Stephane
Stephane Decleire a écrit :
I've forgot to give you the result HTML code for the label :
<label id="null:label"></label>
Stephane
Stephane Decleire a écrit :
I can't figure out how to show the label of a RadioGroup ...
I have tried what i used to do with other form components without
success ...
<t:label for="optin"/>
<t:radiogroup t:id="optin" t:value="user.agree"
t:label="literal:optin-label" t:validate="required">
<t:radio t:id="yes" t:value="true"/> <t:label for="yes"/>
<t:radio t:id="no" t:value="false"/> <t:label for="no"/>
</t:radiogroup>
Any idea ?
Stephane