Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

typing a new date into the <input> does not trigger changeDate #241

Closed
LukeWinikates opened this issue Nov 1, 2012 · 3 comments · Fixed by #295
Closed

typing a new date into the <input> does not trigger changeDate #241

LukeWinikates opened this issue Nov 1, 2012 · 3 comments · Fixed by #295

Comments

@LukeWinikates
Copy link

If I type a new date into the , then tab or click away from the input without clicking on a date in the datepicker, no changeDate event is triggered.

$(input).val() returns the expected date, so this probably works just fine when used in forms, but I've got a backbone view that needs an event to bind to. 'changeDate' works but only captures events triggered by mouseclicks or the documented keyboard navigation.

@eternicode
Copy link
Contributor

Reopening, the proposed fix (#295) didn't fix this.

@eternicode
Copy link
Contributor

The trouble with tabbing away is that we don't know whether the date has changed or not since we last triggered the changeDate event. #295 sort-of solved the problem, but a little too zealously, triggering changeDate multiple times as a date was typed (it also went about it the wrong way, basing the triggering on viewDate instead of date). While that behavior is technically correct (you'll notice the selected date is, indeed, changed with every keystroke), it's probably not ideal, see #318.

@opensas
Copy link

opensas commented Mar 3, 2013

perhaps we could save the value of the input on the focus event (that seems to work) and compare with the actual value of the input on the blur event. if they differ, we would trigger a changedDate event.

BTW, I've just asked a similar question at SO: http://stackoverflow.com/questions/15183541/bootstrap-datepicker-not-picking-change-event-on-input

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants