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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to