tapestry-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Nick Westgate (JIRA)" <...@tapestry.apache.org>
Subject [jira] Created: (TAPESTRY-1709) Radio component throws an exception when used with RadioGroup and Label
Date Thu, 16 Aug 2007 07:47:31 GMT
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


Mime
View raw message