title: jquery autocomplete textbox set value programmatically
body: <p>I am using jquery 1.8.2 and jqueryui 1.9.0 libraries. </p>
  
  <p>I am trying to add an "Edit Record" dialog to my table which contains a autocomplete textbox of jquery-ui.</p>
  
  <p>I am also using the change event of autocomplete to restrict the user for selecting the items from the given list. </p>
  
  <p>My problem is: when I show my edit form, I am setting the existing data to the textbox, however when user clicks on another field in edit form, the change controller popping the error of nothing changed. I have found many samples which show how to set value for combobox type autocomplete but i could not find one for textbox type. Please help me on this issue, i believe your answers will be useful for other users too. </p>
  
  <p>here is my code for autocomplete textbox:</p>
  
  <pre><code>    $("#EditMaterialName").autocomplete({
          source: function (request, response) {
              $.ajax({
                  type: "POST",
                  url: "someurl",
                  dataType: "json",
                  data: {
                      search_string: request.term
                  },
                  success: function (data) {
                      response($.map(data, function (item) {
                          return {
                              label: item.description,
                              value: item.description
                          }
                      }));
                  }
              });
          },
          minLength: 2,
          select: function (event, ui) {
  
          },
          change: function (event, ui) {
              if (!ui.item) {
                  $('&lt;div class="error"&gt;&lt;b&gt; please select a listed value.&lt;/b&gt;&lt;div&gt;').insertAfter('#EditMatName');
                  $('#EditMaterialName').val('');
              }
          },
          open: function () {
              $(this).removeClass('ui-corner-all').addClass('ui-corner-top');
  
          },
          close: function () {
              $(this).removeClass('ui-corner-top').addClass('ui-corner-all');
  
          }
      });
  </code></pre>
  
  <p>and here is the code for showing Edit Record dialog:</p>
  
  <pre><code>$('a.edit_link').live("click", function () {
  
          clearEditMaterialForm();
  
          //loading selected value
          var valMaterialName = $(this).closest('tr').children('td.cl_material_name').text();
  
          $('#EditMaterialName').val(valMaterialName);
  
      });
  </code></pre>
  
  <p>thank you very much for your answers. </p>