I have a form in which if the flag is not editable then the date field is just displayed. If the flag is editable then the user picks a date. However when the form is submitted the date field is null,even if there was an existing date.
<c:forEach items="${company.companyLot}" begin="0" step="1" var="taxLot" varStatus="Index">
<fmt:formatDate value="${company.companyLot[Index.index].lotDate }" type="date" pattern="MM/dd/yyyy" var="LotDate" />
<c:if test="${taxLot.editable eq 'nonEditable' }">
<input type="hidden" name="companyLot[${Index.index }].lotDate" value="${company.companyLot[Index.index].lotDate }" />
<input name="companyLot[${Index.index }].lotDate" value="${LotDate}" disabled="disabled"/>
<form:errors path="companyLot[${Index.index }].lotDate" cssClass="displayErrorClass"></form:errors>
</c:if>
<c:if test="${taxLot.editable eq 'editable' }">
<input id="lotDatePicker" type="text" name="companyLot[${Index.index }].lotDate" value="${LotDate}" maxlength="10"
style="width: 50px" />
<input type="hidden" name="companyLot[${Index.index }].lotDate" value="${editDiscountNote.companyLot[Index.index].lotDate }" />
<form:errors path="companyLot[${Index.index }].lotDate" cssClass="displayErrorClass"></form:errors>
</c:if>
</c:forEach>
I have used hidden fields to pass the date but it doesnt seem to hold on to it in the modelattribute.
Aucun commentaire:
Enregistrer un commentaire