[ 
http://issues.apache.org/jira/browse/MYFACES-735?page=comments#action_12355720 
] 

Frode Oldervoll commented on MYFACES-735:
-----------------------------------------

In method 
org.apache.myfaces.renderkit.html.ext.HtmlMessageRenderer.createOutputLabelMap 
a map of ids and corresponding labels are created. The clientId (the map key) 
in this map (created by input.getClientId) is wrong, it does not include the 
index.

This id appears in the map, assuming the backend bean contains two row:
testForm:testTable:testField

These ids should be in the map instead:
testForm:testTable_0:testField
testForm:testTable_1:testField

There also seems to be a problem with value binding here. If I have a hardcoded 
value (like "Test label") then I can see it in the map from the debugger, but 
if I use value binding (like "#{labels[testLabel]}") then the binding does not 
get resolved, and the value in the map ends up beeing "". In both cases the 
value never appears in any message because the id is wrong.

> dataTable error messages incorrect
> ----------------------------------
>
>          Key: MYFACES-735
>          URL: http://issues.apache.org/jira/browse/MYFACES-735
>      Project: MyFaces
>         Type: Bug
>   Components: Tomahawk
>     Versions: 1.1.0, 1.1.1
>  Environment: Windows XP SP2, JBoss 4.0.2, Java 1.5.0_04
>     Reporter: Frode Oldervoll

>
> Validation messages does not work properly for fields inside a data table. 
> Assigning an id to fields inside a dataTable should work; they still are 
> unique per row since the dataTable index is included in the actual id. The 
> error messages still does not seem to work, however.
>  Here is an example. I have this form with a dataTable inside, which again 
> contains a set of outputLabel/inputText pairs.
> <h:form id="testForm">
>       <t:messages/>
>       <t:dataTable id="testTable">
>             <h:column>
>                   <h:outputLabel for="testField" value="Test label"/>
>                   <h:inputText required="true" id="testField"/>
>             </h:column>
>       </t:dataTable>
> </h:form>
> The actual HTML code generated for a couple of rows 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=""/>
> <label for="testForm:testTable_1:testField">Test label</label>
> <input id=" testForm:testTable_1:testField" name=" 
> testForm:testTable_1:testField" type="text" value=""/>
>  
> Even if the ids in the label and the input field matches I still get the 
> message "Validation Error in testField" instead of "Validation error in Test 
> label".
> This behaviour is not usable in a production environment, and therefore we 
> are enforced to create our own validators where we have full control over the 
> error messages.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira

Reply via email to