drupalprojects / kalatheme

Mirror of http://drupal.org/project/kalatheme provided by hubdrop.
http://hubdrop.org/project/kalatheme
GNU General Public License v2.0
22 stars 29 forks source link

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

Open AgentJay opened 8 years ago

AgentJay commented 8 years ago

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 commented 8 years ago

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 commented 8 years ago

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

soniktrooth commented 7 years ago

@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'])) {