-
Notifications
You must be signed in to change notification settings - Fork 522
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
Dateinput change event happens before value is set #292
Comments
Hey Brad, This is a really annoying bug and unless I'm mistaken it looks like the fix still isn't in the I think jQuery users are pretty accustomed to something close to this being the standard pattern for an auto-submitting input, so it'd be great if the $('#input').change(function() {
$(this).closest('form').submit();
} Any chance we could get this fixed for 1.2.6? |
ya i'll look at it this weekend. I posted this a while ago (before I was a committer to the project) and subsequently forgot about it. I'll try and get this done for the weekend, we're going to be releasing all the latest changes asap! |
Awesome, thanks! I figured that was the case :-) |
Copying in the request and code fix from #230, to remove duplication: "The documenation on events says that jQueryTools uses a beforeEvent and Event pattern for extending standard events. This, I suspected that the author intended (changes tagged with "RDR"). NOTE: This change might break some code which was expecting the html input element to still have the previous value when change event raised. Also, W3C documentation suggests that with <input ... onChange="XXX"/> , XXX is called AFTER the input's value have been updated. Which is what this change does.
//{{{ pick
|
Woohoo! |
I'm not sure if this is on purpose, but there's no afterChange event which makes me think this is a bug. The following jsFiddle illustrates the issue: http://jsfiddle.net/7NNgP/
When a user clicks the calendar, effectively 'changing' the date, the actual value of the input at this time is the value 'before' the date was selected. Is this on purpose?
I would expect that the input value would be the new value set by the calendar. The issue arrises for me as I have a change handler that submits a form, but the value submitted from this date is not the value that the user selected, so each change submits the previous date value selected, which is obviously incorrect.
Two workarounds are possible. Trigger 'change' after the value is set (though this gets awkward as it won't fire if e.isDefaultPrevented is true) or provide another event that is triggered after the value has changed. I've submitted a pull request with the latter option
The text was updated successfully, but these errors were encountered: