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"

Support from Acquia helps fund testing for Drupal Acquia logo

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

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

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

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.

Chris Matthews’s picture

Assigned: beeradb » Unassigned

The 3 year old patch in #17 that addressed the issues presented in #13 applied cleanly to the latest ctools 7.x-1.x-dev, but still needs to be reviewed and tested.

joelpittet’s picture

Status: Needs review » Closed (outdated)

Closing for triage but if this is an issue still, please LMK and we can un-close it and dig deeper.

MustangGB’s picture

Status: Closed (outdated) » Needs review

Still an issue since I checked.

joelpittet’s picture

@MustangGB, thanks for checking! Are you doing the Panopoly Demo or some other way to reproduce?