I cannot get validation messages to work properly for fields inside a data
table.

The following scenario works:
-----------------------------

<h:form id="testForm">
        <t:messages/>
        <h:outputLabel for="testField" value="Test label"/>
        <h:inputText required="true" id="testField"/>
</h:form>

If I submit an empty value here, then I get the error message I expected:
"Validation Error in Test label".

The HTML code for the outputLabel/inputText pair looks like this:

<label for="testForm:testField">Test label</label>
<input id="testForm:testField" 
       name="testForm:testField" 
       type="text" value=""/>


The following scenario does NOT work:
-------------------------------------

<h:form id="testForm">
        <t:messages/>
      <t:dataTable id="testTable">
                <h:outputLabel for="testField" value="Test label"/>
                <h:inputText required="true" id="testField"/>
        </t:dataTable>
</h:form>

If I submit an empty value here, then I get this error message, where the
testField id is not expanded to the label value:
"Validation Error in testField".

The HTML code for the outputLabel/inputText pair now looks like this:

<label for="testForm:testTable_0:testField">Test label</label>
<input id=" testForm:testTable_0:testField" 
       name=" testForm:testTable_0:testField" 
       type="text" value=""/>


Am I doing anything wrong here, or is this a bug?

-Frode Oldervoll


Reply via email to