You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by "Nick Westgate (JIRA)" <de...@tapestry.apache.org> on 2007/09/12 11:29:32 UTC

[jira] Updated: (TAPESTRY-1709) Radio component throws an exception when used with RadioGroup and Label

     [ https://issues.apache.org/jira/browse/TAPESTRY-1709?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Nick Westgate updated TAPESTRY-1709:
------------------------------------

    Attachment: TAPESTRY-1709.patch

This patch fixes Radio and adds tests (which fail without the fix).
It simply caches the element name as described in the issue.

The old test passed because the components were used in a loop.
The test now additionally uses Radio, RadioGroup and Label with no enclosing loop.

Cheers,
Nick.

> Radio component throws an exception when used with RadioGroup and Label
> -----------------------------------------------------------------------
>
>                 Key: TAPESTRY-1709
>                 URL: https://issues.apache.org/jira/browse/TAPESTRY-1709
>             Project: Tapestry
>          Issue Type: Bug
>          Components: tapestry-core
>    Affects Versions: 5.0.5
>            Reporter: Nick Westgate
>         Attachments: TAPESTRY-1709.patch
>
>
> Example code that breaks:
>     <t:RadioGroup t:id="group1">
>         <t:Radio t:id="radio1" t:value="value1"/><t:Label for="radio1"/>
>     </t:RadioGroup>
> Exception is:
> No object of type org.apache.tapestry.RadioContainer is available from the Environment.
> The reason is that the Label validation rendering calls Radio.getElementName() after the RadioGroup has been popped from the environment.
> A simple fix is to cache the element name:
>     private String _elementName;
> ...
>     public String getElementName()
>     {
>         return _elementName;
>     }
> ...
>     void beginRender(MarkupWriter writer)
>     {
>         ...
>         _elementName = _container.getElementName();
>         writer.element("input", "type", "radio", "id", _clientId, "name", _elementName, "value", value);
>         ...
>     }
> Cheers,
> Nick.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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