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 triggered with `mask=true` when leaving input without changes

See original GitHub issue

Describe the bug

The first time I pick any date the ajax event is called twice, this can be checked through F12 the first ajax sends an empty date, and the second the value picked.

<p:datePicker id="value"
		      value="#{testView.date}"
		      mask="true"
		      pattern="dd/MM/yyyy"
		      showIcon="true"
		      showOnFocus="false"> 
	<p:ajax event="change" update="date"/>		 
</p:datePicker>	

Reproducer

primefaces-test-master.zip

Expected behavior

The event should be called just once with the correct value.

PrimeFaces edition

Community

PrimeFaces version

12.0.0.RC3

Theme

No response

JSF implementation

Mojarra

JSF version

2

Java version

2.2.20

Browser(s)

No response

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:17 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
mellowarecommented, Dec 7, 2022

@jan666 here is a reproducer I patched for 12.0.0: pf-9259-patched.zip

Just look in \src\main\webapp\resources\primefaces by including those two patches JS files at the right location they override the ones found in 12.0.0 because the ones in your WAR take precedence.

0reactions
jan666commented, Dec 7, 2022

Works great. Thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Datepicker: Change event is not called when using mask="true"
The behaviour should be the same as the other inputs, the value of the input is changed and the user leaves the field,...
Read more >
Jquery datepicker change event trigger and input's default ...
Set your input readOnly , it will help you to change the value of field through icon only. <input type='text' class='inp' readOnly />....
Read more >
APEX datepicker return value back without triggerring input's ...
I have a report that contains a date picker, which is generated by ... back without triggerring input's change event when using APEX_ITEM....
Read more >
Datepicker not calling ajax "change" on input
Calendar fires "change" when I change the value and leave the field. If I focus the field and leave without modifying it, then...
Read more >
Form Datepicker | Components - BootstrapVue
BootstrapVue custom date picker input form control, which provides full ... By default, when no date is selected, the calendar view will be...
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