Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Autocomplete AJAX widget not detecting if it should be used #284

Open
AgentJay opened this issue Jun 27, 2016 · 3 comments
Open

Autocomplete AJAX widget not detecting if it should be used #284

AgentJay opened this issue Jun 27, 2016 · 3 comments

Comments

@AgentJay
Copy link

Hello,

I'm getting the autocomplete functionality turned on for ALL my fields regardless of whether autocomplete is on or not, even my jQuery range sliders have the AJAX autocomplete enabled.

If I try to enter a value in a field where autocomplete is turned on it works fine. If I try to enter a value in a field where autocomplete is OFF I get an Ajax HTTP error several times.

This is only happening when I use Kala theme.

I'm on the latest release for Drupal 7 (7.x-3.2)

@AgentJay
Copy link
Author

I solved my issue.
in the file 'includes\fapi.inc'
on line 107:
if (isset($element['#autocomplete_path']) && drupal_valid_path($element['#autocomplete_path'])) {
should be changed to:
if (!empty($element['#autocomplete_path']) && drupal_valid_path($element['#autocomplete_path'])) {

!empty is a better check for an empty value, isset seems to be picking up something (blank space?) I'm not 100% sure what it sees, but making this change fixed my issue.

@soniktrooth
Copy link
Contributor

@AgentJay Thanks for this, I will look into it ASAP

@soniktrooth
Copy link
Contributor

@AgentJay I've looked into this and I can confirm that with a basic Drupal + Kalatheme site the behaviour that you're seeing isn't present. My assumption is that your site has a module installed that is inadvertently adding #autocomplete_path to all textfields. I have amended the if statement to cater for this in #291 because it doesn't change the functionality and handles this erroneous case.

Just for the sake of completeness, Drupal core's theme_textfield function uses the following if statement to handle autocomplete:

  if ($element['#autocomplete_path'] && !empty($element['#autocomplete_input'])) {

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants