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.

allowInput=true and Enter keypress form submit

See original GitHub issue

Firstly, thanks for the beautiful date/time picker.

Now, I would like to submit my form on pressing the Enter key when combined with flatpickr with allowInput=true.

Currently flatpickr consumes the Enter keypress event and calls the parseDate callback. Is there a way to disable this?

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:2
  • Comments:5

github_iconTop GitHub Comments

2reactions
megalofaunacommented, Apr 24, 2019

I’m using flatpickr v4.5.2 and seem to running into this issue. Is it possible there has been a regression since the fix?

0reactions
leachimsumiricommented, May 3, 2021

As an aside this also seems to affect pressing enter on a forms textarea. When in a textarea element of a form which has flatpickr, you cannot press enter to go to next line. I think this is due to flatpickr hijacking the enter key for the entire window:

https://github.com/flatpickr/flatpickr/blob/7012a3b025c6aea05e955004082d160ea7f67535/src/index.ts#L412

Update: Figured that the problem was because I was attaching the flatpickr instance to the form wrapper. Attaching it elsewhere solved the issue.

I’m binding the flatpickr instance only to one element but experience the same problem. Every Enter press on an input field opens the datepicker.

flatpickr v.4.5.7

Any solutions?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Submitting a form on 'Enter' with jQuery? - Stack Overflow
Does anyone know if this is a Webkit issue (Adobe AIR uses Webkit for HTML), or if I've bunged things up? I tried:...
Read more >
How to submit a form on Enter button using jQuery
To submit the form using 'Enter' button, we will use jQuery keypress() method and to check the 'Enter' button is pressed or not, ......
Read more >
The Enter Key should Submit Forms, Stop Suppressing it
When enter is clicked in the number input, the keypress event handler determines which submit button is appropriate and clicks it. While this ......
Read more >
Submit Form With Enter Key Using jQuery | John Dalesandro
How to use jQuery to submit a web-based form when the enter key is pressed.
Read more >
How To Trigger Button Click on Enter - W3Schools
Trigger a Button Click on Enter. Press the "Enter" key inside the input field to trigger the button: Button. Example.
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