Autocomplete widget

Autocomplete widget

Hi all,  (sorry for the double post - didn't see the first one go through)

I'm new to jquery and have a couple of questions.

In the code below I have to return(false) in order for the #autocomplete input not to be updated by the value (rather than the label).  It initially updates the label and then as the code continues to run it switches it back to the  value.  Am I doing something wrong?

More general ajax question - I'd like to send a second parameter that changes with changes made to the value of grpDir.  I'm sending the second parameter but it only picks up this value when the page loads.  How can I make this second parameter dynamic?

Code is below.

Thanks in advance for your help.
  1. Directory<BR><div><br>
  2. <input type="radio" id="grpDir" name="grpDir" value="1000"> A
  3. <input type="radio" id="grpDir" name="grpDir" value="2000" checked> B
  4. <input type="radio" id="grpDir" name="grpDir" value="5000"> C
  5. <input type="radio" id="grpDir" name="grpDir" value="6000"> D
  6. </div>  
  7. <input id="autocomplete" size="30" />
  8. <input id="vendorNo" />


  9. Javascript
  10.   $(function() {
  11.     $("#autocomplete").autocomplete({
  12.     source: "autocomplete.asp?dir="+$("input[name=grpDir]:checked").val(),
  13.     minLength: 2,
  14. select: function(event, ui) {
  15.       $('#vendorNo').val(ui.item.value);
  16.       $('#autocomplete').val(ui.item.label);
  17.       return(false);
  18.       }
  19.     
  20.     });
  21.   });