Reputation: 415
I have a form that is broken down into three different categories: Information, Violations, and Important dates. I need to perform form validation in the information, and Important dates categories(which are the 1st and 3rd tabs, respectively). How can I keep track of which inputs are valid and which aren't so that I can send the user to the right tab to fix errors? I am using Jquery validate plug-in from Jorn Zaefferer. Any help in the right direction would be greatly appreciated.
Thanks
Upvotes: 2
Views: 310
Reputation: 14874
you can find elements which have errors with jquery, they will be marked by an attribute or class(I can't remember exactly), then you can use the parentUntil
function to find the tab and select
it.
Upvotes: 1
Reputation: 17719
In the past I have used a validation panel at the top of each tab, and layout each validation error in a table with two columns: tab and message.
Then the user will know which errors occurred where and navigate between tabs.
If there is only one error you could open the tab directly.
You could use the .first(":parent") function to find the parent element (tab) to decide which tab the control is associated with.
Upvotes: 1