SOLVED

Ok

I found in this conversation:

"Form with two buttons determining which was clicked"

by Mark Steudel and Hector Virgen

So If you want add this feature to your UI Tab do this:

       $('#myForm input[type=submit]').click( function(event) {
                       var element = ( event.target ?  event.target :
event.srcElement );

                       $('#myForm').ajaxSubmit({
                               success: function(t) {
                                       if( $(element).attr('id') == 'back' )
{
                                         $('#tabs').tabs('select',0);
                                       }

                                       if( $(element).attr('id') ==
'continue' ) {
                                         $('#tabs').tabs('select',2);
                                       }
                               }
               });


               return false;
               }
       );

Regards

macm

2009/2/6 Mario Moura <moura.ma...@gmail.com>

> Hi James
>
> Not yet, but thanks.
>
> if I find a solution I will post here.
>
> Cheers!
>
>
> macm
>
>
>
>
> 2009/2/6 James <james.gp....@gmail.com>
>
>
>> How about, instead of:
>> x = this.id;
>>
>> try:
>> x = $(this).attr('id');
>>
>> On Feb 6, 1:22 am, Mario Moura <moura.ma...@gmail.com> wrote:
>> > Hi Folks
>> >
>> > I did this with ajax tab options and Jquery Form
>> >
>> > $(document).ready(function() {
>> >     $("#myForm").ajaxForm( function() {
>> >        $("#tabs").tabs("select",2);
>> >     });
>> >
>> > });
>> >
>> > Inside of my tab 1 have
>> >
>> > <input type="submit" id="back" class="click" value="« Back"
>> name="back"/>
>> >
>> > <input type="submit" id="continue" class="click" value="Continue »"
>> > name="continue"/>
>> >
>> > As you can see if I submit #myForm I will go to next tab
>> > $("#tabs").tabs("select",2);
>> >
>> > But to back I am having problems. Because is a second submit button. So
>> I am
>> > trying this:
>> >
>> > $(document).ready(function() {
>> >
>> > $(".click").click(function(){
>> >   //Get the id of this clicked item
>> >   x = this.id;
>> >
>> > });
>> >
>> >   // before submit, call BackOrContinue
>> >   var options = {
>> >     beforeSubmit:  BackOrContinue
>> >   };
>> >
>> >   $("#myform").ajaxForm(options);
>> >
>> >   function BackOrContinue {
>> >
>> >     if (x == "back") {
>> >       $("#tabs").tabs("select",0);
>> >     } else {
>> >       $("#tabs").tabs("select",2);
>> >     }
>> >   }
>> >
>> > });
>> >
>> > My error is $ is not defined
>> >
>> > I tried
>> >
>> >   $("#myForm").ajaxForm( function() {
>> >         x = this.id;
>> >     alert(x);
>> >       if (x == "back") {
>> >           $("#tabs").tabs("select",0);
>> >         } else {
>> >           $("#tabs").tabs("select",2);
>> >         }
>> >    });
>> >
>> > and x = "undefined"
>> >
>> > What is missing?
>> >
>> > Regards
>> >
>> > macm
>>
>
>
>
>
>

Reply via email to