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:
- $("#WithdrawalForm").validate();
- $("#expenseCodes").rules("add", {
- required: true,
- messages: {
- required: "You must enter an Expense Code."
- }
- });
- $("#accountNumbers").rules("add", {
- required: true,
- messages: {
- required: "You must enter an Account Number."
- }
- });
- $("#units").rules("add", {
- required: true,
- messages: {
- required: "You must enter an Owner Unit."
- }
- });
- $("#txtPayee").rules("add", {
- required: true,
- messages: {
- required: "You must enter a Payee."
- }
- });
- $("#allTerminals").rules("add", {
- required: true,
- messages: {
- required: "You must enter an Expense Terminal."
- }
- });
- $("#userTerminals").rules("add", {
- required: true,
- messages: {
- required: "You must enter a Terminal."
- }
- });
- $("#txtAmount").rules("add", {
- required: true,
- messages: {
- required: "You must enter an Amount."
- }
- });
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?