[drupal-devel] [feature] AJAX form_autocomplete() field

Thox drupal-devel at drupal.org
Sun May 22 16:51:09 UTC 2005


Issue status update for http://drupal.org/node/22519

 Project:      Drupal
 Version:      cvs
 Component:    base system
 Category:     feature requests
 Priority:     normal
 Assigned to:  Anonymous
 Reported by:  Thox
 Updated by:   Thox
 Status:       patch

I've made quite a few changes to the code to clean up the following:


- Better theme compatibility (changes since 4.6)
- HTML encoding of usernames before display on screen
- Some extra general-purpose JS functions in drupal.js
- Partially cleaned up CSS


I need to check if UnConeD thinks the new JS is close enough to the
drupal coding guidelines.




Thox



Previous comments:
------------------------------------------------------------------------

May 10, 2005 - 15:29 : Thox

Attachment: http://drupal.org/files/issues/form_autocomplete.patch (11.48 KB)

As discussed on #drupal, I've created a patch to add an AJAX-based
form_autocomplete() field to the Drupal core.


The documentation of the autocomplete callback remains undocumented.
See http://drupal.org/node/22471 for more details.




------------------------------------------------------------------------

May 10, 2005 - 19:18 : Thox

I've created a demonstration page that works in a number of different
browsers:


http://brandedthoughts.co.uk/node/62




------------------------------------------------------------------------

May 10, 2005 - 20:50 : Dries

Works on Firefox @ MacOS.




------------------------------------------------------------------------

May 10, 2005 - 23:14 : solon

Don't mean to throw a spanner in the works, but I get an error if the
request I type does not match any in the database/ file it is looking
through.
-- Begin Error --
JavaScript
An HTTP error undefined occured.
http://brandedthoughts.co.uk/recipe/ingredient/autocomplete
-- End Error --


Would it be best to have it display an ' informative' error message, or
stop trying to 'guess' if it definately can't find a match?


BTW: I am using Safari 2.0 Mac OsX (you don't say :P )




------------------------------------------------------------------------

May 11, 2005 - 00:16 : solon

The error no longer shows, so that issue seems to be fixed (in Safari 2
anyway. As far as I can tell, this is the only browser that it occcured
in).




------------------------------------------------------------------------

May 11, 2005 - 00:17 : moshe weitzman

one more nit - pressing escape should ideally caused tghe autocomplete
div to disappear. sometimes it is not wanted.


please submit a patch against HEAD, if possible.




------------------------------------------------------------------------

May 11, 2005 - 08:01 : Junyor

After typing a number of short terms, I start getting incorrect results.
  It seems mostly to happen with words starting with the letter "b",
oddly enough.


In Opera, the page scrolls when you use arrows to select results.  The
cursor doesn't move to the end of the selected word after you press
Enter.  If the list is open with an item selected and you tab away, the
list doesn't disappear.


I also so some weirdness in Firefox and Opera when using the mouse to
select entries.  Sometimes the drop-down wouldn't disappear.




------------------------------------------------------------------------

May 11, 2005 - 10:14 : Thox

solon: I've fixed that on the demo page now, it seems Safari can't
access the connection status property (so it shows as "undefined").


moshe: the patch above is/was against CVS HEAD, I've just posted it
wrongly. I agree about hitting escape, so I'll try to do that one.


Junyor: I might be able to stop the scrolling, but I'll have to check
on some other things first. Which version of Opera were you using and
which OS? The dropdown hides correctly for me when I tab out in Opera 8
on Windows.


A problem I find with creating this control is that I need to
completely define my own behaviour. I'd like it to act exactly as the
user expects, so I'll try ironing out the above bugs.




------------------------------------------------------------------------

May 11, 2005 - 15:12 : Junyor

I tested with Opera 8.0 and an internal build of 8.01 on Windows XP. 
I'll see if I can find a way to reproduce the problem.  E-mail me if
you have any questions about getting stuff working in Opera.




------------------------------------------------------------------------

May 21, 2005 - 12:45 : Dries

What is the status of this?  I'd like to see this move forward.  Are you
going to roll a patch Thox?




------------------------------------------------------------------------

May 21, 2005 - 16:40 : Thox

Attachment: http://drupal.org/files/issues/autocomplete.patch (13.38 KB)

New patch - mostly usability improvements



Fixed solon's Safari 2.0 error.
Pressing escape now makes the suggestions dissapear (until you type
some more).
Pressing enter now doesn't submit the form when the suggestions are
open, it simply selects the suggestion.
Changed the node author field to an autocomplete field (Dries'
suggestion).

AFAIK, the only outstanding usability issue is that Opera will scroll
up and down when the user tries to move up and down through the
suggested results. This behaviour also happens on the Google suggest
[1] site, so I'm assuming it is very difficult to avoid.
[1] http://www.google.com/webhp?complete=1&hl=en




------------------------------------------------------------------------

May 22, 2005 - 12:35 : Dries

I believe UnConeD (Steven) provide some feedback on IRC.  Is that
correct?  I hope this patch can be committed shortly but I'll hold back
this patch until approved/reviewed by UnConeD.







More information about the drupal-devel mailing list