primefaces: Datepicker: Change event is not called when using mask="true"
Describe the defect The ajax “change event” is not called when the date is type istead of being selected. The behaviour should be the same as the other inputs, the value of the input is changed and the user leaves the field, the event is called. Calendar works like this.
Environment:
- PF Version: 10.0
- JSF + version: _e.g. Mojarra 2.2.14
- Affected browsers: ALL_
To Reproduce Steps to reproduce the behavior:
- focus datepicker
- type a date and leave
- change event is not called
Expected behavior If I change the value of the datepicker typing the date then the ajax method “change” should be called.
Example XHTML
<p:datePicker mask="true"
value="#{testView.data}"
maskSlotChar=" "
pattern="dd/MM/yyyy"
monthNavigator="true"
yearNavigator="true"
showIcon="true"
showOnFocus="false">
<p:ajax event="dateSelect" listener="#{testView.onDateSelect()}"/>
<p:ajax event="change" listener="#{testView.onChange()}"/>
</p:datePicker>
Example Bean
@Named
@ViewScoped
public class TestView implements Serializable {
private Date data;
public void onDateSelect() {
System.out.println("hi date select");
}
public void onChange() {
System.out.println("hi onChange");
}
public Date getData() {
return data;
}
public void setData(Date data) {
this.data = data;
}
}
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 17 (12 by maintainers)
Commits related to this issue
- Fix #7176: InputMask bug with DatePicker onchange event — committed to melloware/primefaces by melloware 3 years ago
- Fix #7176/#6445: DatePicker not handling events properly with mask — committed to melloware/primefaces by melloware 3 years ago
- Fix #7176/#6445: DatePicker not handling events properly with mask (#7182) — committed to primefaces/primefaces by melloware 3 years ago
It’s working now, thanks a lot 😃
I will test this in my application as soon as I find some time for it. Thanks for improving the fix. I totally agree with you (PR message), that no time should be wasted for IE anymore (even our company has switched to MS Edge Chome and our IT is really slow 😉)
OK try this patched version. All fixes are in the
test.jsfile. pf-7176.zip@fanste This also fixes #6445