jQuery UI autocomplete combobox validation issue

jQuery UI autocomplete combobox validation issue

Hey all! I'm having some issues getting jquery validation to work with the jquery ui autocomplete combobox.

I can get it to work, but only if I have just one of these comboboxes on my page. If I have more than one, it will only validate the first one on the form and will use the last custom message that I added for another combobox. Here's some code to show what I mean:

  1. $("#WithdrawalForm").validate();
  2. $("#expenseCodes").rules("add", {
  3.     required: true,
  4.     messages: {
  5.         required: "You must enter an Expense Code."
  6.     }
  7. });
  8. $("#accountNumbers").rules("add", {
  9.     required: true,
  10.     messages: {
  11.         required: "You must enter an Account Number."
  12.     }
  13. });
  14. $("#units").rules("add", {
  15.     required: true,
  16.     messages: {
  17.         required: "You must enter an Owner Unit."
  18.     }
  19. });
  20. $("#txtPayee").rules("add", {
  21.     required: true,
  22.     messages: {
  23.         required: "You must enter a Payee."
  24.     }
  25. });
  26. $("#allTerminals").rules("add", {
  27.     required: true,
  28.     messages: {
  29.         required: "You must enter an Expense Terminal."
  30.     }
  31. });
  32. $("#userTerminals").rules("add", {
  33.     required: true,
  34.     messages: {
  35.         required: "You must enter a Terminal."
  36.     }
  37. });            
  38. $("#txtAmount").rules("add", {
  39.     required: true,
  40.     messages: {
  41.         required: "You must enter an Amount."
  42.     }
  43. });

The fields with txt in front of them are just basic text inputs, and they validate fine. The others are all the names of my select lists that are getting turned into the autocomplete textboxes. Only the first select list gets validated for being empty, and it uses the 'userTerminals' required message instead of its own. If I move one of the other rules to the bottom of the javascript code, then the message becomes whatever that has.

Does anyone have a clue as to how to validate these?