Klaus Hartl wrote: > That would be done like: > > $('#container>ul>li>a:eq(2)').click(function() { > if (formIsValid()) { > $('#container-1').enableTab(2).triggerTab(2); > } > return false; > }); > > Well, not exactly. The problem is that you're submittig a form, and that > is going to be asynchronous I assume... That's totally not supported for > onClick, because I just cannot stop execution of the rest of the script > while waiting for the response of the form submit. > You're right that wouldn't work.. that's why I would like to cancel tab activation if onClick returns false. This way I can do;
$(container).tabs({remote: true, onClick: submitForm}); var clickedTab = false; function submitForm(tab, content, oldContent) { // pseudo code... clickedTab = index_of_tab; $(form,oldContent).submit(); // NOTE; the forms plugin is attached to the form, and asynchronously submits it. Upon form return, successCallback is called. // cancel tab activation -- *KEY* behavior return false; } function successCallback() { if(form passed server side validation) $(container).triggerTab(clickedTab); else ... (form did not pass server side validation) } ~ Brice _______________________________________________ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/