[jQuery] Re: tabs: possible to save a form when switching tabs?

2008-02-15 Thread Klaus Hartl
On Feb 15, 5:34 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > 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.

[jQuery] Re: tabs: possible to save a form when switching tabs?

2008-02-15 Thread [EMAIL PROTECTED]
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:

[jQuery] Re: tabs: possible to save a form when switching tabs?

2008-02-14 Thread Klaus Hartl
On Feb 15, 5:08 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > Thanks, but that didn't work.  I have > > >         $(function() { >                 $('#tabcontent > ul').tabs({click: function(clicked, > toShow, toHide) { >                                 alert(toHide.title); >              

[jQuery] Re: tabs: possible to save a form when switching tabs?

2008-02-14 Thread Klaus Hartl
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

[jQuery] Re: tabs: possible to save a form when switching tabs?

2008-02-14 Thread Klaus Hartl
On Feb 15, 4:06 am, FrenchiINLA <[EMAIL PROTECTED]> wrote: > if you use the click event of tab it pass 3 parameters Tab clicked, > Tab toShow, TabtoHide so you can write something like > var $tabs = $('#foo).tabs({click: function(clicked, toShow, toHide) { > var title = toHide.title; > . > > }

[jQuery] Re: tabs: possible to save a form when switching tabs?

2008-02-14 Thread [EMAIL PROTECTED]
Thanks, but that didn't work. I have $(function() { $('#tabcontent > ul').tabs({click: function(clicked, toShow, toHide) { alert(toHide.title); } }); }); Docum

[jQuery] Re: tabs: possible to save a form when switching tabs?

2008-02-14 Thread FrenchiINLA
if you use the click event of tab it pass 3 parameters Tab clicked, Tab toShow, TabtoHide so you can write something like var $tabs = $('#foo).tabs({click: function(clicked, toShow, toHide) { var title = toHide.title; . }); On Feb 14, 6:28 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: >

[jQuery] Re: tabs: possible to save a form when switching tabs?

2008-02-14 Thread [EMAIL PROTECTED]
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

[jQuery] Re: tabs: possible to save a form when switching tabs?

2008-02-14 Thread Klaus Hartl
On Feb 14, 9:25 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > Thanks, Klaus.  I only want to run this form validation if a user is > leaving the tab with a.title = "Properties".  How do I screen for that > prior to executing the function? - Dave var $tabs = $('#foo').tabs().bind('select.ui

[jQuery] Re: tabs: possible to save a form when switching tabs?

2008-02-14 Thread [EMAIL PROTECTED]
Thanks, Klaus. I only want to run this form validation if a user is leaving the tab with a.title = "Properties". How do I screen for that prior to executing the function? - Dave On Feb 14, 12:43 pm, Klaus Hartl <[EMAIL PROTECTED]> wrote: > Try the select event. If the handler for that event ret

[jQuery] Re: tabs: possible to save a form when switching tabs?

2008-02-14 Thread Klaus Hartl
Try the select event. If the handler for that event returns false you won't be allowed to switch tabs. Something like: var $tabs = $('#foo').tabs().bind('select.ui-tabs', function(e, ui) { return validateForm( $('#tabcontent div.ui-tabs-container:visible form')[0] ); }); I assumed youhave to