Reputation: 263
JavaScript function after clicking on clear button
function resetTime() {
document.getElementById("to_time").valueAsDate = null;
}
PrimeFaces calendar tag
<p:calendar id="to_time"
value="#{anomaliesList.toDate}"
readonlyInput="true"
maxdate="#{currentDate}"
size="16"
pattern="dd/MM/yyyy HH:mm" />
Upvotes: 1
Views: 646
Reputation: 20188
First of all, p:calendar
is deprecated. Use p:datePicker
instead.
The easiest way to deal with this is setting a widgetVar
on your p:datePicker
. This allows you to use the client side API.
To reset a date, use:
PF('yourWidgetName').setDate(null);
Note that if you want to use getElementById
you probably need to incorporate the form clientId.
See also:
Upvotes: 1