auto-submit.js has a special mode for text inputs where it will submit on key presses instead of on change like other fields.
The problem is when another module displays an enhanced text fields, for example a date picker, keyboard input becomes optional or disabled for that field.
See for example this date_popup issue: #1512928: When using an exposed date view filter with popup and autosubmit, form is not submitted on date selection
There is no standard way to determine if a text field is enhanced. I think the submit on key press for text fields should be simply removed and the submit should occur on the more standard 'change' event, which will be compatible with any field enhancement.
| Comment | File | Size | Author |
|---|---|---|---|
| #19 | ctools-change-event-instead-of-keypress-1694988.patch | 657 bytes | kitikonti |
| #4 | autosubmit_enhanced_textfield-1694988-4.patch | 589 bytes | jkuma |
Comments
Comment #1
merlinofchaos commentedNo, the submit on key press is a very important feature. I'm not going to just remove it.
Comment #2
cedric commentedOK but do you have any insight on how to fix this issue?
We could go the straightforward way and revert to the standard change() listener for text fields that have the .hasDatepicker class, there are some patches floating around for that.
It only fix the problem for the specific date picker issue. Any other input[type=text] based widgets would still be affected.
I'm just trying to keep the conversation going.. Any pointers would be appreciated.
Comment #3
merlinofchaos commented#1708438: Incompatibility Between Chaos Tools Auto Submit and Autocomplete Fields! is also this problem, and contains a patch for autocomplete fields.
Right now the only thing I could think of would be some kind of class we could add to the widget that would tell CTools to react to change, rather than keypress. That's still going to be a pain but at least we could fix things with alters, probably.
Comment #4
jkuma commentedHi folks,
I've made a patch for auto-submit.js. I've added an onChange event in order to trigger value changes when using datepicker or other enhanced text field.
I hope it will help you !
Comment #5
arlinsandbulte commentedNote: #1512928: When using an exposed date view filter with popup and autosubmit, form is not submitted on date selection has been marked as a duplicate of this issue.
Comment #6
jkuma commentedComment #7
mustanggb commented#4 solves the issue for datepicker
Comment #8
ibuildit commentedThe patch solves the problem for me too, but only part-ways as it doesn't work on in-between dates. It will autosubmit the start date and refresh the view.
Comment #9
ibuildit commentednot very clean workaround: set a relative date "today" on the end date.
Comment #10
mustanggb commentedI must admit I am using in-between in a similar way. For my use-case I auto-set the end date and completely hide it from the user so they are only required to enter a start date.
Comment #11
cmarcera commented+1 for #4 fixing my date picker now auto-submitting correctly. Thanks!
Comment #12
merlinofchaos commentedThis doesn't inadvertantly cause multiple submits, does it? We need to test for that to be sure, I think.
Comment #13
mustanggb commentedFairly sure it doesn't as I checked at the time, but it's been a while and could use a second pair of eyes for sure.
Comment #14
merlinofchaos commentedOkay, committed and pushed then.
Comment #16
hswong3i commentedSorry still not able to find #4 from latest 7.x-1.x-dev, double confirm with http://drupalcode.org/project/ctools.git and also looks not yet apply since 2013-02-14 as mentioned on #14. Shall we double check about this?
Comment #17
mustanggb commentedHere it is: http://drupalcode.org/project/ctools.git/blobdiff/72f137fe5c7ec8a903b50e...
Comment #18
hswong3i commentedOh due to the patch pattern even it is already goes into latest -dev but still able to apply patch without error message...
Thank you very much and confirm that this issue already well committed ;-)
Comment #19
kitikonti commentedSo if anyone like me needs to change the key press event to a change event, i have created a patch that removes the keypress event.