I have an Autocomplete on a form that uses local data. However, the
input allows users to enter values that are not in the local data
array. If the user enters and selects matching data the .result
callback function sets a corresponding key value that is submitted
with the form. The intent is to help enter known values, but others
are allowed.

What I'm observing is that if a match is entered, the corresponding
key will be set. But if the user further edits the matched value the
autocomplete doesn't fire again. This creates a problem because the
key never changes. Is that expected autocomplete behavior? If so, is
there a workaround?

Here's the code:

                $("#calibration_location_name").autocomplete( locations, {
                        minChars: 0,
                        width: 310,
                        selectFirst: false,
                        scroll: true,
                        matchContains: "word",
                        mustMatch: false,
                        autoFill: false,
                        formatItem: function(row, i, max) {
                                return row.name;
                        },
                        formatMatch: function(row, i, max) {
                                return row.name;
                        },
                        formatResult: function(row) {
                                return row.name;
                        }
                })
                .result(LocationAutoCompleteCallback)
                .blur( function(){
                        if($(this).val() === '') {
                                $("#calibration_locationkey").val(0);
                        }
                });

Thanks

Reply via email to