0

このスクリプトのダイアログ ボックス部分は機能しますが、フォームは送信されません

    $(document).ready(function(){
  $("form#audit_delete_form").submit(function(e) {
    e.preventDefault();
    var $form = $(this);
    if ($form.find('select[name="audit_id_select"]').val() == "") {
        $.msgbox("Please select an audit", {
        type:"alert",
        buttons: [
        {type: "submit", value: "OK"}
        ]
      });
    }else{
        $.msgbox("Are you sure you want to permanently delete this audit?", {   
        type: "confirm",
         buttons : [
            {type: "submit", value: "Yes"},
            {type: "submit", value: "No"},
            {type: "cancel", value: "Cancel"}
          ]
      }, function(result){
          if(result == 'Yes'){
              $(this).submit()
          }
      });

    }
  });
});
4

1 に答える 1

0

e.preventDefault();とにかく使ってみてください。次に、ユーザーが確認した場合に送信を発行します。

$(THE_SUBMIT_BUTTON_ID).click(function(e){
e.preventDefault();
if(...){...}
else{
        $.msgbox("Are you sure you want to permanently delete this audit?", {   
        type: "confirm",
         buttons : [
            {type: "submit", value: "Yes"},
            {type: "submit", value: "No"},
            {type: "cancel", value: "Cancel"}
          ]
      }, function(result){
          if(result == 'Yes'){
              $("form#audit_delete_form").submit() // We only submit when prompted
          }
于 2013-08-29T23:52:51.710 に答える