I need help with what event to use on jQueryUI Autocomplete

I need help with what event to use on jQueryUI Autocomplete

I've got the autocomplete widget working perfectly.  It pulls Json after 3 characters min and sets a hidden textbox with the Id and puts the description in the name field.

The problem occurs when 'after selecting a valid record' the user adds to the text thus creating a custom record.  I need to figure out a way when this occurs to clear out the hidden field again so a new record is created and not using the selected value.

Does this make sense?

Here is the html code:
  1. <input type="hidden" name="Contact_AccountId" id="Contact_AccountId">
  2. <input type="text" name="AccountName" id="AccountName" />
and here is the javascript:
  1.  $("#AccountName").autocomplete({
                source: "/Account/SearchJson",
                minLength: 3,
                select: function (event, ui) {
                    $('#Contact_AccountId').val(ui.item.id);
                }
            });






Any help would be greatly appreciated. 

Thanks,

ScAndal












    • Topic Participants

    • kevin