Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to stop the submission of the form using JQUERY?
    primarykey
    data
    text
    <p>I have a form which have many check boxes in it. User will check one or many checkboxes and click on Delete button which is actually submit button then the respective records for selected check boxes are get deleted.</p> <p>Required operation steps are as follows:-</p> <p>When user selects one or more checkboxes and clicks the submit button then a JQUERY code is get executed in which</p> <ol> <li>It should checks that if any check box is selected; if not; then is displays alert message and do not submit the form.</li> <li>If it founds that one or more checkboxes are selected it should ask user for his/her confirmation using confirm alert box about the confirmation of deletion.</li> <li>If user press YES button on confirm box then it should submit the form using javascript submit statement. </li> <li>If user pressed the NO button then it should unchecks the checked selected checkboxes and should not submit the form.</li> </ol> <p>This is the JQUERY code I had written.</p> <pre><code>$(document).ready(function () { $("#id_delete").click(function() { var temp = $("#id_frm input:checkbox:checked"); var len = temp.length; if(len==0) { alert("Please select the order."); } else { if (confirm("Are you sure to delete the selected orders.")) { $("#id_frm").submit(); } else { temp.checked=false; } } }); }); </code></pre> <p>Problems:</p> <p>This code is not working properly. Here 1. It submits form when there is no check box is selected. 2. It submits the form when user press NO button on confirmation dialog box.</p> <p>I want to write this code on button click event only.</p> <p>Please guide me friends in this problem.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload