You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Borut Bolčina <bo...@gmail.com> on 2010/08/02 12:12:11 UTC

Label id for RadioGroup component is "null-label"

Hi,

I am trying to use the "No Validation Bubbles" from the JumpStart and it
works just fine, but it fails for RadioGroup component. After some FireBug
investigation I found out that this template:

<t:label for="cctype"/>:
<t:radiogroup t:id="cctype" validate="required">
    <t:radio t:id="masterCard"/>
    <t:label for="masterCard"/>
    <t:radio t:id="visa"/>
    <t:label for="visa"/>
</t:radiogroup>

renders as:

<label id="*null*-label">CC Type</label>:<input type="radio" id="masterCard"
name="cctype" value="MASTER_CARD" />
<label for="masterCard" id="masterCard-label">Master Card</label>
<input type="radio" id="visa" name="cctype" value="VISA" />
<label for="visa" id="visa-label">Visa</label>

I would expect:
<label id="*cctype*-label">CC Type</label>


I have a properties file and the browser correctly displays the label from:
cctype-label=CC Type

as it can be seen from the HTML source code.

I guess the "No Validation Bubbles" can not handle elements with ids such as
"null-something". I will look into the sources now...

...but the question is: Is this a bug in Tapestry 5.1.0.5?


Regards,
Borut

Re: Label id for RadioGroup component is "null-label"

Posted by Borut Bolčina <bo...@gmail.com>.
OK, I downloaded the sources for T 5.1.0.5 from
https://svn.apache.org/repos/asf/tapestry/tapestry5/tags/releases/5.1.0.5

and the RadioGroup.java has a method getClientId which always returns null:


    /**
     * Returns null; the radio group does not render as a tag and so doesn't
have an id to share.  RadioGroup implements
     * {@link org.apache.tapestry5.Field} only so it can interact with the
{@link org.apache.tapestry5.ValidationTracker}.
     *
     * @return null
     */
    public String getClientId()
    {
        return null;
    }

Why is then in the documentation at
http://tapestry.apache.org/tapestry5/tapestry-core/ref/org/apache/tapestry5/corelib/components/RadioGroup.html

the option to set clientId if it always returns null? Would it brake
something if RadioGroup component would return clientId as other
(renderable) components?

>From user's perspective the validation error messages should be displayed
the same for TextBox, Select, RadioGroup and others. And of course it would
be great if validation can be implemented in the same pattern for developers
also.

I can see that error bubbles can not be applied to radio group (they should
be removed from further versions of Tapestry), but the mechanics for
displaying the error message should be the same for all components. It is
not ok, to just make the label and all the radios red when no radio is
selected, for example. IMHO the text should be displayed somewhere in the
vicinity of the RadioGroup.

What do you say and how the hell should I display the error message if user
selected no radio option without too much coding (client and server side
validation)?

Cheers,
Borut


2010/8/2 Borut Bolčina <bo...@gmail.com>

> Hi,
>
> I am trying to use the "No Validation Bubbles" from the JumpStart and it
> works just fine, but it fails for RadioGroup component. After some FireBug
> investigation I found out that this template:
>
> <t:label for="cctype"/>:
> <t:radiogroup t:id="cctype" validate="required">
>     <t:radio t:id="masterCard"/>
>     <t:label for="masterCard"/>
>     <t:radio t:id="visa"/>
>     <t:label for="visa"/>
> </t:radiogroup>
>
> renders as:
>
> <label id="*null*-label">CC Type</label>:<input type="radio"
> id="masterCard" name="cctype" value="MASTER_CARD" />
> <label for="masterCard" id="masterCard-label">Master Card</label>
> <input type="radio" id="visa" name="cctype" value="VISA" />
> <label for="visa" id="visa-label">Visa</label>
>
> I would expect:
> <label id="*cctype*-label">CC Type</label>
>
>
> I have a properties file and the browser correctly displays the label from:
> cctype-label=CC Type
>
> as it can be seen from the HTML source code.
>
> I guess the "No Validation Bubbles" can not handle elements with ids such
> as "null-something". I will look into the sources now...
>
> ...but the question is: Is this a bug in Tapestry 5.1.0.5?
>
>
> Regards,
> Borut
>