Yes, the idea of saving the selected tab in a variable will do nicely.

Just for posterity, I wanted to include that the line

var selected = $tabs.data('selected.ui-tabs');

is causing a JS error, "$tabs is not defined."

Thanks, - Dave

On Feb 15, 1:24 am, Klaus Hartl <[EMAIL PROTECTED]> wrote:
> On Feb 15, 3:28 am, "[EMAIL PROTECTED]"
>
> <[EMAIL PROTECTED]> wrote:
> > Thanks, but let me throw in an additional wrinkle.  Let's say there
> > are three tabs, with titles "Properties", "General", and "Misc" and
> > you are on tab "General" and then click on tab "Misc".   The below
> > functionality would get called, even though it is only supposed to be
> > called if you are leaving the "Properties" tab.  Any way to adjust the
> > below for this situation?
>
> >  - Dave
>
> Ok, let's assume the "Properties" tab is the first one and not rely
> too much on the title which may change and you don't want to change
> your script in that case. Try:
>
> var $tabs = $('#foo').tabs().bind('select.ui-tabs', function(e, ui) {
>     if (!selected) { // short for selected == 0
>         return validateForm( $('#tabcontent div.ui-tabs-
> container:visible form')[0] );}).bind('show.ui-tabs', function(e, ui) {
>
>     selected = ui.options.selected;});
>
> var selected = $tabs.data('selected.ui-tabs');
>
> Are we getting close?
>
> --Klaus

Reply via email to