1

ASP.NET-MVC でフォームを送信するために機能している送信ボタンがあります。

ボタンクリックにjQueryダイアログを付けたいと思います。ユーザーがダイアログを終了した場合、送信も終了したいと思います。

他のボタンにフックされたダイアログがありますが、送信はありません。これどうやってするの?

****編集済み****

これは、別のボタンにあるダイアログの例です。

<button type="button" id="create-company" >Create Company</button>

<div id="popupCreateService_Line" title="Create a new service line"> 
<fieldset>
    <label for="service_line_name">Name:</label>
    <%= Html.TextBox("service_line_name") %>

    <label for="service_line_desc">Desc:</label>
    <%= Html.TextBox("service_line_desc") %>

</fieldset>
</div>

$("#create-service_line").click(function() {
                $('#popupCreateService_Line').dialog('open');
            });
4

2 に答える 2

1

これをフォームロードイベントに添付してください..

  $(document).bind("keyup.EventPopupEvents", null, function(event)
{
    if (event.keyCode == 27)
    {
        ShutdownEditEventForm();
    }
});

次の 2 つの関数を追加します。

 function ShutdownEditEventForm(){
$(document).unbind(".EventPopupEvents");
HidePopup($("#EventPopup"));}

function HidePopup($popup){
$("#PopupBackground").hide();
$("#PopupBackground").remove();
$popup.hide();}

これをフォームの読み込みに追加して保存します。

$("#EditEventSaveButton").click(function() { SaveEvent(id, onSaveCallback); });

h番目:)

于 2010-04-30T18:28:03.433 に答える
-1

ダイアログで、カスタムCSSダイアログを参照しているのか、JavaScriptの確認ダイアログを参照しているのかわかりません。後者の場合、このコードは問題なく動作するはずです。

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <title></title>
        <script type="text/javascript" src="http://code.jquery.com/jquery-latest.js"></script>
    </head>
    <body>
        <form method="get" action="focusout.htm">
            <input type="submit" id="button" value="Submit" />
        </form>
        <script type="text/javascript">

            $("#button").click(function () {
                return confirm("are you sure you want to click?");
            });
        </script>
    </body>
    </html>
于 2010-04-30T18:15:00.337 に答える