problem with autocomplete plugin

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

problem with autocomplete plugin


Hi list, I need some help with autocomplete plugin.

I have two text field (name and surname) and I need to add to the name
field the autocomplete like this:
When the user start writing on it, it shows the coincidences and when
he select the correct item the surname field most be filled too. For

HTML tags:

<input type="text" id="name" /><br />
<input type="text" id="surname" /><br />

Javascript code:

$().ready(function() {
        $("#name").autocomplete(records, {
                minChars: 0,
                width: 250,
                matchContains: 1,
                autoFill: true,
                onItemSelect: function(row) {
                        $("#surname").value = row.surname;
                onFindValue: function(row) {
                        $("#surname").value = row.surname;
                formatItem: function(row, i, max) {
                        return + " " + row.surname;
                formatMatch: function(row, i, max) {
                formatResult: function(row) {


records its a javascript array like:

var records = [
{ name: "John", surname: "Smith"},
{ name: "Ian", surname: "Crawford"},
{ name: "Derek", surname: "Lee"}

As I can see, I have problems with "onFindValue" and "onItemSelect"

You received this message because you are subscribed to the Google Groups "jQuery Plugins" group.
To post to this group, send email to [hidden email]
To unsubscribe from this group, send email to [hidden email]
For more options, visit this group at