2016-10-18 8 views
0

確認用のボックスでリンク/ポップアップを使用しています。しかし、これをチェックボックスに移して、送信ボタンを押す必要があります。 JQueryをフォームで使用するための助けが必要です。何か案は?ここで確認用ポップアップボックスにチェックボックス/サブミット設定を入力する

https://jsfiddle.net/829mf5qx/2/

<!-- Used with JQuery function below --> 
    <a href="delete.cfm" onclick="return confirm('Are you sure you want to confirm the order?');">Confirm order?</a> 


    <!-- Need to edit the Jquery below to work with this code block --> 
    <div style="margin-top:20px;"> 
    <form name="orderReceived" action="" method="post" onsubmit="return confirm_update();"> 
     <input type='checkbox' name='files' id='1' value='1' /> Confirm order? 
     <br> 
     <input type="submit" value="Submit" name="submit"> 
    </form> 
    </div> 




    $(document).ready(function() { 
     $('a[data-confirm]').click(function(ev) { 
      var href = $(this).attr('href'); 
      if (!$('#dataConfirmModal').length) { 
       $('body').append('<div id="dataConfirmModal" class="modal" role="dialog" aria-labelledby="dataConfirmLabel" aria-hidden="true"><div class="modal-header"><button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button><h3 id="dataConfirmLabel">Please Confirm</h3></div><div class="modal-body"></div><div class="modal-footer"><button class="btn" data-dismiss="modal" aria-hidden="true">Cancel</button><a class="btn btn-primary" id="dataConfirmOK">OK</a></div></div>'); 
      } 
      $('#dataConfirmModal').find('.modal-body').text($(this).attr('data-confirm')); 
      $('#dataConfirmOK').attr('href', href); 
      $('#dataConfirmModal').modal({show:true}); 
      return false; 
     }); 
    }); 
+0

は、あなたがボタンをクリックすると、確認ボックスを表示したいん...チェックボックスを完了する必要がありますか? –

+0

こんにちはAlexandru、はい、チェックボックスがチェックされ、送信ボタンがクリックされたときにのみ確認ボックスが表示されます – me9867

+0

次のこの第2部分は、現在私のために効果的に機能しているようですhttp://jsfiddle.net/DBHEz/353/ – me9867

答えて

0

あなたのソリューションです:?jsfiddle

$(function(){ 
    $('#submit').click(function(){ 
     if($("#checkbox").is(':checked')){ 
      if(confirm('Are you sure you want to confirm the order?')){ 
       $('#submitHelper').click(); 
      } 
     } 
    }); 
}); 
関連する問題