my form looks like this:
When the user clicks \"+ Add\" a new distanc
I need to be able to show individual "required" messages. Any ideas?
For that you don't need to fiddle with IDs. JSF will do it for you. Just do
<h:dataTable id="table" value="#{bean.distances}" var="distance">
<h:column>
<h:inputText id="distance" value="#{distance.value}" required="true" />
<h:message for="distance" />
</h:column>
</h:dataTable>
This will end up in generated HTML like follows:
<table id="form:table">
<tr><td><input id="form:table:0:distance" /></td></tr>
<tr><td><input id="form:table:1:distance" /></td></tr>
<tr><td><input id="form:table:2:distance" /></td></tr>
...
</table>
Rightclick the page in browser and choose View Source to see it yourself.
Any validation error will just be shown in the same row as the input.