Download & Extend

Fix auto-submit for enhanced text text fields

Project:Chaos tool suite (ctools)
Version:7.x-1.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed (fixed)

Issue Summary

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

#1

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

#2

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.

#3

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

#4

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 !

AttachmentSizeStatusTest resultOperations
autosubmit_enhanced_textfield-1694988-4.patch589 bytesIdlePASSED: [[SimpleTest]]: [MySQL] 24 pass(es).View details

#5

#6

Status:active» needs review

#7

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

#4 solves the issue for datepicker

#8

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.

#9

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

#10

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.

#11

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

#12

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

#13

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.

#14

Status:reviewed & tested by the community» fixed

Okay, committed and pushed then.

#15

Status:fixed» closed (fixed)

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

#16

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?

#17

Status:reviewed & tested by the community» closed (fixed)

Here it is: http://drupalcode.org/project/ctools.git/blobdiff/72f137fe5c7ec8a903b50e...

#18

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

nobody click here