hello friends,

i took autocomplete to make some ajax field choices from a database poered site.

it works great, but i had the pleasure to add a small contribution too.

1. the ability to send additional fields data in the ajax call could
of course be achieved with extraParams option. but i needed it for
multiple fields, and to add multiple other fields to each ajax call.
hence i made an additional list[] option, extraFields, that will add a
key-value pair for each field in the list. if the field name is
preceeded by an '#', this will be considered the id of the field (but
the '#' will be stripped on the ajax url). otherwise, the field will
be searched in the same form with our input, by it's name.

2. after i used the alt-shift keys combination to switch the keyboard
mapping before inputing data to a field, the autocomplete process
wouldn't start when minchars (=1) was reached. with a little
debugging, i found 2 key events are being sent in sequence, 18 and 0.i
have disabled changes check on 18, but also 16 and 17: control, alt
and shift keys.

3. probably out of ignorance, i have refocused the input after user
selects from the list with return. if the user selects using the
keyboard, s?he may certainly wish to use the keyboard and tab to the
next field, while bluring it moves, in firefox, the focus to the form,
so that pressing tab will move focus to the first field.
in case that's a terrible mistake on my part, do you have any better
idea? i would certainly add an option to move focus to the next field
after selecting completion, whether by return or by click.

4. for the case the user programmer would select jquery compatible
mode, where jQuery() won't be aliased by $(), autocomplete would fail,
since it still calls jQuery() by $(). as a disciplined programmer, i'd
definitely change that.

jquery.autocomplete.ja is naturally attached. please diff to see my changes.

best regards,
alex

Attachment: jquery.autocomplete.js
Description: JavaScript source

Reply via email to