0

First of all, sorry for my bad English. I have read all posts with same subject without success because it seems I wrote same code.

Problem:

Dialog appears when first page is loaded (good). I close this dialog, switch tabs to '?' and come back on 'accueil' tab (index 0) where dialog must appear for selecting data file. The overlay fills the window, but dialog is not shown.

Here is my code :

        $(function() {

            var $dialog = $( "#dialog" )
                .dialog({
                    autoOpen: false,
                    modal: true,
                    resizable: false,
                    draggable: false,
                    close: function(event,ui) {
                        form[ 0 ].reset();
                    }
            });

            $dialog.dialog('open');

            $(window).resize(function() {
                $('.headet').height($(window).height()-55);
                $('.subet').height($(window).height()-95);
            });

            function ajaxid(tabid){
                $(tabid).empty();
                $(".ui-jqgrid").remove();
                var url='pages/'+tabid.substr(1)+'.html';
                $.ajax({
                    url:url,
                    type:'GET',
                    dataType:'html',
                    success:function(donnees){
                        $(tabid).html(donnees);
                        $(tabid).scrollTop(0);
                    }
                });
            }

            var $tabs=$('#tabs');
            var $subtabs=$('.subtabs');

            $tabs.tabs();
            $tabs.removeClass('ui-widget-content');
            //*******************
            //  CLIC APPLICATION
            //*******************
            var pidtab, sidtab=0;
            $tabs
            .tabs({
                disabled: [1,2,3,4,5],
                activate:function(event,ui){
                    var index=$tabs.tabs("option", "active");
                    pidtab=$tabs.find(" ul>li a").eq(index).attr('href').substr(4);
                    $("#sub"+pidtab).tabs('option','active',0);
                    var tabid='#sub'+pidtab+'1';
                    sidtab=tabid.substr(1);
                    if($(tabid).hasClass('p10')){
                        ajaxid(tabid);
                    }
                    var tabOpts={};
                    switch(index){
                        case 0:
                            $dialog.dialog('open');
                            break;
                        case 6:
                            tabOpts = { disabled: [2,3,4]};
                            break;
                        default:                
                    }
                    $subtabs.tabs(tabOpts);
                }
            });

            $subtabs.tabs();
            $subtabs.removeClass('ui-widget-content');
            //**************
            //  CLIC MODULE
            //**************
            $subtabs.tabs({
                activate:function(event,ui){
                    sidtab=ui.newTab.attr("aria-controls");
                    if($('#'+sidtab).hasClass('p10')){
                        ajaxid("#"+sidtab);
                    }
                }
            });
            $('ul.ui-tabs-nav').removeClass('ui-corner-all').addClass('ui-corner-top');
        });
    </script>

and the html part with dialog box :

    <body>
    <div id="dialog" title="Ouverture">
        <form>
            <fieldset class="ui-helper-reset">
                <label for="data_file">Fichier</label>
                <input type="text" name="data_file" id="data_file" value="" class="ui-widget-content ui-corner-all">
            </fieldset>
        </form>
    </div>

Probably it is a little thing which breaks program, but I can't find where and why this happens. As I need to select data file for continuing, I hope somebody will have some precious time to give me some help. Many thanks in advance for that. Have a nice day.

1 Answer 1

1

The problem is you didn't define form object used on dialog.close()

My solution:

close: function(event,ui) {
           $(this).find('form')[0].reset();
       }

Test:

http://jsfiddle.net/tTMcc/1/

Sign up to request clarification or add additional context in comments.

1 Comment

Many thanks Jarek, that's run fine ! As I said, this was a little thing, a newbie mistake. Many thanks again

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.