The problem creeps in when the Chaos Tools auto submit functionality is enabled

Here is how to replicate:
-- Uncomment ctools_add_js('auto-submit') and '#attributes' => array('style' => 'display: none', 'class' => array('widget-preview-button', 'ctools-use-ajax', 'ctools-auto-submit-click')) in panopoly_magic.module
-- Attempt to add a "Featured Demo Item" from Panopoly Demo
-- Try to use the autocomplete to change the "Featured Demo Item"

CommentFileSizeAuthor
#17 ctools-1708438-17.patch376 bytesMustangGB
#6 1708438-blur-event.patch807 bytesbeeradb
PASSED: [[SimpleTest]]: [MySQL] 121 pass(es). View
#5 1708438-blur-event.patch765 bytesbeeradb
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch 1708438-blur-event.patch. Unable to apply patch. See the log in the details link for more information. View
#3 1708438-autosubmit-autocomplete.patch1.18 KBbeeradb
PASSED: [[SimpleTest]]: [MySQL] 58 pass(es). View
Members fund testing for the Drupal project. Drupal Association Learn more

Comments

populist’s picture

Assigned: Unassigned » beeradb
beeradb’s picture

This is caused by the auto submit binding to textfields on keypress events rather than change events. There are a couple ways we can fix this.

  1. Write a patch for ctools which checks for the auto complete class on textfields and binds them with the change event, similar to how non-textfield form elements work. Looking at the auto-submit.js code in ctools it's going to be somewhat of a messy patch. I'm not sure it would get accepted, but we can always ping Earl and ask him about it before we go down that road.
  2. Bind the ctools auto submit to specific form elements rather than using the ctools-auto-submit-full-form class. We can then write our own JS which binds to autocomplete element and submits the form on a change event.
beeradb’s picture

Project: Panopoly » Chaos tool suite (ctools)
Status: Active » Needs review
FileSize
1.18 KB
PASSED: [[SimpleTest]]: [MySQL] 58 pass(es). View

The attached patch looks to resolve this for me. The jquery selectors are a bit funky, but I didn't see a better way to implement it. This should allow auto-submit functionality to work with autocomplete fields.

merlinofchaos’s picture

Status: Needs review » Closed (duplicate)

This is the same problem as reported here #1694988: Fix auto-submit for enhanced text text fields but with a different widget in the way.

This fix will work, sort of, but it's a poor band-aid for the real problem, which is that any text field that also has other javascript attached to it is going to have issues with the auto submit. I'm going to mark this one as a duplicate and crosspost.

beeradb’s picture

FileSize
765 bytes
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch 1708438-blur-event.patch. Unable to apply patch. See the log in the details link for more information. View

The last patch failed to work on webkit browsers. Moving the event to a blur instead of a change works on webkit. Here's a new patch that should work for firefox / chrome / safar auto complete fields until the larger issue is resolved. IE has not been tested.

beeradb’s picture

FileSize
807 bytes
PASSED: [[SimpleTest]]: [MySQL] 121 pass(es). View

Re-roll against latest 7x-1.x-dev

vasike’s picture

Status: Closed (duplicate) » Needs review

definitely not a duplicate of #1694988: Fix auto-submit for enhanced text text fields.
the issue is still there for text with autocomplete filters.

i tested the last patch (#6) and it seems it does its job.
tested with autocomplete text filter for term reference fields and also for Views Autocomplete Filters.

So re-open for review.

Kristen Pol’s picture

I tested patch in #6 but am getting an error when using the autocomplete now:

An AJAX HTTP request terminated abnormally.
Debugging information follows.
Path: http://zkristen.local/autocomplete_filter/field_publication_value/view_admin_press/admin_press_page
StatusText: 
ResponseText: 
ReadyState: 4
k_ankur’s picture

#6 worked for me. Thanks beeradb.

jphelan’s picture

Issue summary: View changes
Status: Needs review » Reviewed & tested by the community

#6 works for me as well.

DamienMcKenna’s picture

MustangGB’s picture

Currently what happens is typing in the textbox triggers autosubmit, but clicking an option offered by the autocomplete list doesn't trigger it.

After appling the patch typing in the textbox doesn't trigger autosubmit, but clicking an option does.

This resolves one issue, but introduces several others, namely that it will only work with complete names/titles/whatever, partial completes (i.e. operator contains) no longer work, and also that removing any text in the textbox won't trigger the submit until the textbox loses focus. I think both of these are inconsistent with how a user or developer familiar with the Drupal ecosystem would reasonably expect it to work.

Removing the .filter() and using only the .blur() event resolves these.

MustangGB’s picture

Status: Reviewed & tested by the community » Needs work
DamienMcKenna’s picture

Moving this to the v7.x-1.10 release plan.

iampuma’s picture

Latest patch #6 works fine, thanks!

MustangGB’s picture

Status: Needs work » Needs review
FileSize
376 bytes

And a patch as per comments in #13.

DamienMcKenna’s picture

This didn't get added to 7.x-1.10.