Search code examples
tapestry

Tapestry: Can not show error for radiogroup


There are zone > form > radiogroup in tml. Also present button at page. My radiogroup is:

<t:radiogroup t:id="myRadioGroup" value="radioGroupValue" >
        <t:loop source="myRadioGroupList" value="radioGroupItem">
                <div class="radio">
                    <input t:type="radio" t:id="radio3" value="${radioGroupItem}"/>
                </div>
        </t:loop>
    </t:radiogroup>
<t:error for="myRadioGroup"/>

Java code:

@Component
private RadioGroup myRadioGroup;
@Property
private Integer radioGroupValue;

public Integer[] getMyRadioGroupList() {
    return new Integer[] { 1, 2 };
}

@Property
private Integer radioGroupItem;

On click button, executed my validation method, where I called:

myForm.recordError(myRadioGroup, "test");

But I do not see on page any error. If put to form textfield and add error for textfield, then error showing for textfield.

If I add <t:errors/>, then I see all errors: for radiogroup and for textfield.

But why error for radiogroup not visible?


Solution

  • Does it behave properly if you add a validate parameter to your radio group?

    <t:radiogroup t:id="myRadioGroup" value="radioGroupValue" validate="required">

    If so, then you may be hitting this Tapestry bug: https://issues.apache.org/jira/browse/TAP5-1513