You could try this: always return false in the select handler
(basically prevent tab switching), remember the clicked tab and if the
user says "Yes" activate the tab manually (untested, I may have messed
up parentheses):

var TabSolicitud = $('#SolicitudAguaTabContainer > ul').tabs({
    select: function(e, ui) {
        $("#InfoDialog").html("Do you want to save changes?");
        $("#InfoDialog").dialog({
            ...
            buttons: {
                "Yes": function() {
                    $(this).dialog("close");
                    SaveChanges();
                    TabSolicitud.tabs('select', ui.index);
                },
                "NO": function() {
                    $(this).dialog("close");
                }
            }
        });
        return false;
    }
});

If ui.index doesn't work for - it has been added not too long ago -
you can just use ui.panel.id instead.


--Klaus


On 30 Sep., 19:03, oscarml <[EMAIL PROTECTED]> wrote:
> Hi. Nobody can help me with this issue?
>
> I don´t know if is crearly enough:
>
> On the select propertie of the tab I call a function. This works great
> with validation plugin, due to it returns true or false without user
> action. the problem is when I present a dialog to the user in order to
> determine weather to return true or false. when I launch the dialog,
> it returns true to the select tab event, so despite the dialog launchs
> and wait for user choice, the tab has already changed.
>
> thanks
>
> On 14 sep, 11:51, oscarml <[EMAIL PROTECTED]> wrote:
>
> > Hi klaus,
>
> > I had already read the FAQ, and as you can see in my code I'm using
> > the select property. This works fine for example if you run a function
> > that returns true or false without asking user anything, but in my
> > case I need the user to choose one option. Then, when I offer the
> > dialog box, the code inside the 'select' property is returning true,
> > before the user press a button.
>
> > Any idea?
>
> > On 1 sep, 06:18, Klaus Hartl <[EMAIL PROTECTED]> wrote:
>
> > > See 
> > > FAQ:http://docs.jquery.com/UI/Tabs#...prevent_switching_to_the_tab_on_cli...
>
> > > --Klaus
>
> > > On Aug 31, 5:23 pm,oscarml<[EMAIL PROTECTED]> wrote:
>
> > > > Hi to everybody,
>
> > > > I'm trying to control tab switching depending on user answer to a
> > > > dialog. Here is my code;
>
> > > > var TabSolicitud = $('#SolicitudAguaTabContainer > ul').tabs({
> > > >                 select: function(e, ui){
> > > >                         $("#InfoDialog").html("Do you want to save 
> > > > changes?");
> > > >                         $("#InfoDialog").dialog({
> > > >                                 modal: true,
> > > >                                 addClass: 'ModalInfo',
> > > >                                 resizable: false,
> > > >                                 title: "<img 
> > > > src='imagenes/messagebox_info.png' class='img_title' />&nbsp; ",
>
> > > >                                 overlay: {
> > > >                                     opacity: 0.5,
> > > >                                     background: "black"
> > > >                                         },
> > > >                                     buttons: {
> > > >                                         "Yes": function() {
> > > >                                                     
> > > > $(this).dialog("close");
> > > >                                                     SaveChanges();
> > > >                                                  },
> > > >                                         "NO": function() {
> > > >                                                  
> > > > $(this).dialog("close");
> > > >                                                  return false;
> > > >                                                  }
>
> > > > });
>
> > > > The problem is that when I show the dialog, the tab switched to the
> > > > selected one. It doesn´t wait until it knows the answer of the user.
>
> > > > What could I do?

Reply via email to