In a form, I have a section with a list of objects :
<c:forEach items="#{myAction.listEtude}" var="etude">
Each object etude
has a begin date and a end date. There's a custom validator (already exist in the application) to validate that the begin date is before the end date.
This is an extract to show you the begin date bloc :
<rich:calendar id="rsqEtdDateDebut" value="#{etude.rsqEtdDateDebut}">
<f:attribute name="nomForm" value="Risques et expositions" />
<f:attribute name="dateSup" value="#{rsqEtdDateFin}" />
<f:validator validatorId="dateDebInfValidator" />
</rich:calendar>
And a little after, the end date bloc :
<rich:calendar id="rsqEtdDateFin" binding="#{rsqEtdDateFin}" value="#{etude.rsqEtdDateFin}">
</rich:calendar>
User can add a new item in the list by clicking on a add button (call a java function in the action class and render the section).
The validator works fine, but when the user want to add a new item etude
, the input field for end date is bind with the first item only and there's no end date field for all new item and the validation only takes the only one end date in the form.
When I try to delete the binding attribute, the add button works fine (every item has a end date) but of course the validation doesn't work anymore, because no binding attribute involve a null value send to the function.
I don't know how to correct this. Does anyone have an idea? Thanks in advance.