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.

Comments

merlinofchaos’s picture

No, the submit on key press is a very important feature. I'm not going to just remove it.

cedric’s picture

OK 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.

merlinofchaos’s picture

#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.

jkuma’s picture

StatusFileSize
new589 bytes

Hi 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 !

arlinsandbulte’s picture

jkuma’s picture

Status: Active » Needs review
mustanggb’s picture

Version: 7.x-1.0 » 7.x-1.x-dev
Status: Needs review » Reviewed & tested by the community

#4 solves the issue for datepicker

ibuildit’s picture

The 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.

ibuildit’s picture

not very clean workaround: set a relative date "today" on the end date.

mustanggb’s picture

I 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.

cmarcera’s picture

+1 for #4 fixing my date picker now auto-submitting correctly. Thanks!

merlinofchaos’s picture

This doesn't inadvertantly cause multiple submits, does it? We need to test for that to be sure, I think.

mustanggb’s picture

Fairly 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.

merlinofchaos’s picture

Status: Reviewed & tested by the community » Fixed

Okay, committed and pushed then.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

hswong3i’s picture

Status: Closed (fixed) » Reviewed & tested by the community

Sorry 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?

mustanggb’s picture

Status: Reviewed & tested by the community » Closed (fixed)
hswong3i’s picture

Oh 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 ;-)

kitikonti’s picture

Issue summary: View changes
StatusFileSize
new657 bytes

So 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.