I am using the following code to display my web form in Jquery tabs:
//Setup Jquery tabs form
var tabOpts = {
fx: { opacity: "toggle", duration: 5 },
show: function () {
var selTab = $("#EntryForm").tabs('option', 'selected');
$("#<%= hidLastTab.ClientID %>").val(selTab);
},
selected: '<%= hidLastTab.Value %>'
};
I am using the hidden field to keep the selected tab after a postback occurs. I have several dropdowns on the page that create a postback.
I want to set the active tab based on the validation error. If there is a validation error on tab 1, I want to display that tab to the user. How do I set that based on the code I have above?
1. apply jquery validation on the field ... that might take a while for changing code
2. a better option is call a function Page_ClientVallidate() for validating your form (
also ValidationGroup can be used for checking specific fields like given in following link ) and call error
On error there will be some UI changes in the page. May be you will show the errormessage mear to the control or add a css class to highlight a control. Using jquery find any of such behaviour and then find the corresponing tab index. And set the tab index
like some posts below-
2. a better option is call a function Page_ClientVallidate() for validating your form (
also ValidationGroup can be used for checking specific fields like given in following link ) and call error
Yes I am doing that already. I use that technique in a lot of my pages with JQuery.
The problem is setting the active tab to the one where the error occurs.
BlueTSX
Member
203 Points
144 Posts
JQuery tabs, set active based on error
Nov 14, 2012 09:20 PM|LINK
I am using the following code to display my web form in Jquery tabs:
//Setup Jquery tabs form var tabOpts = { fx: { opacity: "toggle", duration: 5 }, show: function () { var selTab = $("#EntryForm").tabs('option', 'selected'); $("#<%= hidLastTab.ClientID %>").val(selTab); }, selected: '<%= hidLastTab.Value %>' };I am using the hidden field to keep the selected tab after a postback occurs. I have several dropdowns on the page that create a postback.
I want to set the active tab based on the validation error. If there is a validation error on tab 1, I want to display that tab to the user. How do I set that based on the code I have above?
newbiefreak
Member
468 Points
214 Posts
Re: JQuery tabs, set active based on error
Nov 14, 2012 10:47 PM|LINK
hi,
there are 2 options for doing it
1. apply jquery validation on the field ... that might take a while for changing code
2. a better option is call a function Page_ClientVallidate() for validating your form ( also ValidationGroup can be used for checking specific fields like given in following link ) and call error
e.g http://razeeb.wordpress.com/2009/01/11/calling-aspnet-validators-from-javascript/
asteranup
All-Star
30184 Points
4906 Posts
Re: JQuery tabs, set active based on error
Nov 15, 2012 09:15 AM|LINK
Hi,
On error there will be some UI changes in the page. May be you will show the errormessage mear to the control or add a css class to highlight a control. Using jquery find any of such behaviour and then find the corresponing tab index. And set the tab index like some posts below-
http://delicious.com/anupdg/tabs+selectedindex
Anup Das Gupta
Mark as Answer if you feel so. Visit My Blog
BlueTSX
Member
203 Points
144 Posts
Re: JQuery tabs, set active based on error
Nov 16, 2012 06:49 PM|LINK
Yes I am doing that already. I use that technique in a lot of my pages with JQuery.
The problem is setting the active tab to the one where the error occurs.