我想对日期选择器进行验证,如果用户未选择任何日期,那么我们将收到错误消息“请选择正确的日期”
<div class="col-12">
<div class="form-check form-group form-date-picker retailer-checkbox">
<form:checkbox path="dateRangeType" value="yearRange" class="form-check-input" id="date-range-3${suffix}" />
<label class="form-check-label" for="date-range-3${suffix}"></label>
<formElement:formInputDatePicker idKey="dateFr${suffix}" labelKey="checkout.multi.shipment.need.by.date.pattern" path="dateFr" mandatory="false" dataRole="data-role='c-date-picker-from'" />
<span class="c-date-picker__to"><spring:theme code="history.filter.date.to"/></span>
<formElement:formInputDatePicker idKey="dateTo${suffix}" labelKey="checkout.multi.shipment.need.by.date.pattern" path="dateTo" mandatory="false" dataRole="data-role='c-date-picker-to'" />
</div>
</div>
<div class="col-12 c-history-filters__section-header"><spring:theme code="history.filter.needs.by.date.range"/></div>
<div class="col-12">
<div class="form-check form-group form-date-picker retailer-checkbox">
<form:checkbox path="needsByDateRange" value="yearRange" class="form-check-input" id="date-range-4${suffix}" />
<label class="form-check-label" for="date-range-4${suffix}"></label>
<formElement:formInputDatePicker idKey="needByDateFr${suffix}" labelKey="checkout.multi.shipment.need.by.date.pattern" path="needByDateFr" mandatory="false" dataRole="data-role='c-date-picker-from'" />
<span class="c-date-picker__to"><spring:theme code="history.filter.date.to"/></span>
<formElement:formInputDatePicker idKey="needByDateTo${suffix}" labelKey="checkout.multi.shipment.need.by.date.pattern" path="needByDateTo" mandatory="false" dataRole="data-role='c-date-picker-to'" />
</div>
</div>