question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Datepicker: Change event is not called when using mask="true"

See original GitHub issue

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:

  1. focus datepicker
  2. type a date and leave
  3. 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;
	}
	
}

primefaces-test-master.zip

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:17 (12 by maintainers)

github_iconTop GitHub Comments

1reaction
SirErrorcommented, Apr 1, 2021

OK try this patched version. All fixes are in the test.js file. pf-7176.zip

@fanste This also fixes #6445

It’s working now, thanks a lot 😃

1reaction
fanstecommented, Mar 31, 2021

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 😉)

Read more comments on GitHub >

github_iconTop Results From Across the Web

jQuery masked input with datepicker fires onChange event ...
Just update to the latest jQuery (1.9.0) and latest maskedInput (1.3.1). This was a bug that got resolved - Look at the change...
Read more >
Datepicker not calling ajax "change" on input
I saw that calendar is deprecated, so I'm trying to move to Datepicker. I have something like: Code: Select all <p:datePicker mask="true" value= ......
Read more >
Kendo UI Date Picker with DateInput change in how Mask ...
Hi, I'm Using Kendo UI Date Picker control with DateInput as true and Format as "MM-dd-yyyy". When Date Picker gets render, it shows...
Read more >
Date & Time Picker - V-Calendar
An elegant calendar and datepicker plugin for Vuejs.
Read more >
DateTimePicker - XDSoft.net
Full options list ; allowTimes, [] ; mask, false, Use mask for input. true - automatically generates a mask on the field 'format',...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found