2011-12-24 22 views
0

我想創建對話框,它可以顯示錶單,我可以刷新子頁面上的頁面內容。需要在jQuery中創建一個對話框,它可以作爲表單

我想在對話框中打開一個計算器。在提交價值後提供輸入。計算應該在同一視圖中更新表格。在同一個對話框中。

我使用JQuery並使用控制器提交數據。請親指導我如何去做。

感謝,

回答

1

嘗試使用jQuery UI的對話框 http://jqueryui.com/demos/dialog/#modal-form

創建一個ID '計算器形式' 的格式,並把它作爲如下對話。

$("#calculator-form").dialog({ 
     autoOpen: false, 
     height: 300, 
     width: 350, 
     modal: true, 
     buttons: { 
      "Submit": function() { 
         //you can get the controls on the main page and do you logic here and close the dialog 
        $(this).dialog("close"); 
       } 
      }, 
      Cancel: function() { 
       $(this).dialog("close"); 
      } 
     }, 
     close: function() { 
      allFields.val("").removeClass("ui-state-error"); 
     } 
    }); 
相關問題