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/08/16 09:47:31 UTC
[jira] Created: (TAPESTRY-1709) Radio component throws an exception
when used with RadioGroup and Label
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
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
[jira] Closed: (TAPESTRY-1709) Radio component throws an exception
when used with RadioGroup and Label
Posted by "Howard M. Lewis Ship (JIRA)" <de...@tapestry.apache.org>.
[ https://issues.apache.org/jira/browse/TAPESTRY-1709?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Howard M. Lewis Ship closed TAPESTRY-1709.
------------------------------------------
Resolution: Fixed
Fix Version/s: 5.0.6
> 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
> Assignee: Howard M. Lewis Ship
> Fix For: 5.0.6
>
> 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
[jira] Assigned: (TAPESTRY-1709) Radio component throws an
exception when used with RadioGroup and Label
Posted by "Howard M. Lewis Ship (JIRA)" <de...@tapestry.apache.org>.
[ https://issues.apache.org/jira/browse/TAPESTRY-1709?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Howard M. Lewis Ship reassigned TAPESTRY-1709:
----------------------------------------------
Assignee: Howard M. Lewis Ship
> 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
> Assignee: Howard M. Lewis Ship
> Fix For: 5.0.6
>
> 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
[jira] Updated: (TAPESTRY-1709) Radio component throws an exception
when used with RadioGroup and Label
Posted by "Nick Westgate (JIRA)" <de...@tapestry.apache.org>.
[ 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
[jira] Commented: (TAPESTRY-1709) Radio component throws an
exception when used with RadioGroup and Label
Posted by "Chris Lewis (JIRA)" <de...@tapestry.apache.org>.
[ https://issues.apache.org/jira/browse/TAPESTRY-1709?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12520230 ]
Chris Lewis commented on TAPESTRY-1709:
---------------------------------------
I can verify this behavior. My workaround is to simply use raw label tags.
> 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
>
> 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