2012-11-16 49 views
0

我有一個提交按鈕,用於觸發對話框在表單驗證過程中打開。它可以在Firefox和Chrome中正常工作,但在IE8中,當它出現一次並關閉後,當我再次單擊該按鈕時,只會出現疊加模式,並且對話框消失。這裏是我的代碼:IE8中只出現一次JQuery UI對話框

//VALIDATION OF FORM STARTS HERE 
$('input[type="submit"]').click(function() { 

    //create the dialog box 
    $.fx.speeds._default = 500; 
    $("#dialog-message_er").dialog({ 
     autoOpen: false, 
     modal: true, 
     show: "blind", 
     hide: "drop", 
     buttons: { 
      Ok: function() { 
       $(this ).dialog("close"); 
      } 
     } 
    }); 

    if (empty) { 
     //get the count of errorforms 
     required_length = error_forms_req.length; 
     //get the list of missed required fields 
     var reqlist = ''; 
     for (var i=0; i<required_length; i++) { 
      reqlist += '<li>' + error_forms_req[i] + '</li>'; 
     } 

     $('#dialog-message_er ul').append('<li class="req">You have missed the following required fields <ul> ' + reqlist + ' </ul></li>'); 

     $("#dialog-message_er").dialog("open"); 
     return false; 
    } else { 
     return true; 
    } 
}); 
+0

我不知道......也許jQuery的版本? I8錯誤? http://stackoverflow.com/questions/2687042/in-ie8-jquery-uis-dialog-set-the-height-of-its-contents-to-zero-how-can-i-fix – Luccas

+0

更新:我得到它固定!我認爲在對話框的隱藏事件中有一個使用jquery ui效果「drop」的bug。我只是把它恢復到「爆炸」的默認效果,它再次正常工作。 – webbysignerph

+0

謝謝你們的回覆。 – webbysignerph

回答

0

如由Luccas提供的提問時指出,你也許可以嘗試對話框元素設置height('auto')

$("#dialog-message_er").dialog({ 
     autoOpen: false, 
     modal: true, 
     show: "blind", 
     hide: "drop", 
     buttons: { 
      Ok: function() { 
       $(this).dialog("close"); 
      } 
     } 
    }).height('auto'); 
+0

更新:我弄明白了!我認爲在對話框的隱藏事件中有一個使用jquery ui效果「drop」的bug。我只是把它放回到「爆炸」的默認效果 – webbysignerph