Ok, I see now. If you include a relative/absolute url in the href of
the tab anchors, the plugin will load the selected one, nothing new.
You on the other hand include a url as well as the content already
included the tab panel. To avoid that loading just use a hash first
and then *later* on change the href to a url to ajaxify the tab. Like
(removed some PHP to reduce noise):
<ul class="ui-tabs-nav">
<li class="ui-tabs-selected"><a href='#Change_Password"'
title='Change Password' >Change Password</a></li>
<li>...</li>
</ul>
$(document).ready(function() {
var tabs = $('div.tab-container > ul.ui-tabs-nav').tabs();
// change url after initialization
tabs.tabs('url', 0, '<?php echo
url_for('@user_admin_change_password?username=' . $sf_user-
>getUsername(),true); ?>');
});
Although I would try - if possible - to pass responsibility to PHP and
let the included tab component return the correct content and let the
ajax tab just load the proper thing. That seems to be cleaner to me.
By the way: instead of display: none you could stick to the tabs
classes and use "ui-tabs-hide" to hide the tab panels.
<div id="Change_Password" class="ui-tabs-panel<?php
if($focus<>'password') echo " ui-tabs-hide" ?>">
HTH, --Klaus
On 6 Nov., 17:23, Sean Dundon <[EMAIL PROTECTED]> wrote:
> Hey Klaus,
>
> Thanks for the quick reply. I am very impressed with your attention
> to maintaining and troubleshooting this plugin, I have seen your posts
> around a lot, and they have been a major help.
>
> I have been pretty careful with how I call tabs(), as at first I got
> confused with what to call it on. Also, I am testing with the Change
> Password section.
>
> Anyway, the code is attached, and my limited testing results in the
> following:
>
> If the one call is removed from the js file, the tabs work as
> expected, ajax-free.
> If id='Change_Password' is removed, then the partially-completed form
> is displayed, and a new div with id='Change_Password' is created above
> it upon the tabs loading.
>
> This leads me to believe that tabs() is clearing the div for the li
> with class='ui-tabs-selected' and loading it via AJAX w/ the href
> attribue of the a with class='ui-tabs-selected'.
>
> I have tried to simplify everything as much as possible, and this
> works flawlessly if I don't call the tabs() method (except there is no
> AJAX). If I call the tabs() method, then there is what seems to be an
> ajax autoload.
>
> // This is the js file
> $(document).ready(function() {
> $('div.tab-container > ul.ui-tabs-nav').tabs();
>
> });
>
> // This is the html
> <h1>Account Administration</h1>
>
> <!-- User Account Admin -->
> <div class='tab-container' >
>
> <!-- TABS -->
> <ul class="ui-tabs-nav">
> <li class="<?php if($focus=='password') echo "ui-tabs-selected" ?>"><a
> href='<?php echo url_for('@user_admin_change_password?username='.
>
> $sf_user->getUsername(),true); ?>' title='Change Password' >
> Change Password
> </a></li>
> <li class="<?php if($focus=='email') echo " ui-tabs-selected " ?>"><a
> href='<?php echo url_for('@user_admin_change_email?username='.
>
> $sf_user->getUsername(),true); ?>' title="Change Email">
> Change Email
> </a></li>
> <li class="<?php if($focus=='privacy') echo " ui-tabs-selected " ?>"><a
> href='<?php echo url_for('@user_admin_privacy_settings?
>
> username='.$sf_user->getUsername(),true); ?>' title="Privacy
> Settings">
> Privacy Settings
> </a></li>
> <li class="<?php if($focus=='notification') echo " ui-tabs-
> selected " ?>"><a href='<?php echo
> url_for('@user_admin_notification_settings?username='.$sf_user->getUsername(),true);
> ?>' title="Notification Settings">
>
> Notification Settings
> </a></li>
> </ul>
>
> <div id='Change_Password' style="<?php if($focus<>'password') echo
> "display:none" ?>" class='ui-tabs-panel'>
> <?php if( ($focus=='password') ): ?>
> <?php
> include_component('user','adminChangePassword',array('form'=>$form)); ?
>
> <?php endif; ?>
> </div>
>
> <div id='Change_Email' style="<?php if($focus<>'email') echo
> "display:none" ?>" class='ui-tabs-panel'>
> <?php if( ($focus=='email') ): ?>
> <?php include_component('user','adminChangeEmail'); ?>
> <?php endif; ?>
> </div>
>
> <div id='Privacy_Settings' style="<?php if($focus<>'privacy') echo
> "display:none" ?>" class='ui-tabs-panel'>
> <?php if( ($focus=='privacy') ): ?>
> <?php include_component('user','adminPrivacySettings'); ?>
> <?php endif; ?>
> </div>
>
> <div id='Notification_Settings' style="<?php
> if($focus<>'notification') echo "display:none" ?>" class='ui-tabs-
> panel'>
> <?php if( ($focus=='notification') ): ?>
> <?php include_component('user','adminNotificationSettings'); ?>
> <?php endif; ?>
> </div>
>
> </div>
>
> On Nov 6, 2:06 am, Klaus Hartl <[EMAIL PROTECTED]> wrote:
>
> > Sounds like you're calling tabs() a second time which will then
> > autoload. This seems to be the actual problem, not that you can't
> > override autoload.
>
> > Could you post a demo or some code?
>
> > --Klaus
>
> > Sean Dundon schrieb:
>
> > > Hey all,
>
> > > This post is in continuation of
> > >http://groups.google.com/group/jquery-ui/browse_frm/thread/7f1691a12d...
> > > which I could not post to for some reason.
>
> > > I would like to second Jaime Ochoa Malag n in his request for an
> > > overriding option of the autoload feature.
>
> > > I am greatly enjoying this product, but I am using these tabs for
> > > account settings forms. After a form is submitted, I will forward
> > > user to some other page, or else, in case of validation errors, I
> > > would like to show them the form again. I load up the form with
> > > validation into the pane, set the pane as active, and serve it up.
>
> > > Upon submitting an invalid form, I see a flash of exactly what I want:
> > > An invalid, partially-filled form, with informative error messages.
> > > However, this is immediately replaced by a new clean form.
>
> > > Is there any way whatsoever to skip the autoloading of the active tab
> > > when calling $('div.tab-container > ul.tab-nav').tabs(); ?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"jQuery UI" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/jquery-ui?hl=en
-~----------~----~----~----~------~----~------~--~---