javascript - bootbox confirm not working when inside a <form> tag -
i've following code
html:
<div class="portlet-body"> <div class="table"> <table class="table table-advance table-hover"> <thead> <tr> <th><strong>#</strong></th> <th><strong>status</strong></th> <th><strong>name</strong></th> <th><strong>mobile no</strong></th> <th><strong>phone no</strong></th> <th><strong>email</strong></th> <th><strong>litigation</strong></th> <th><strong>address</strong></th> <th colspan="2"><strong>actions</strong></th> </tr> </thead> <tbody> <tr> <td>1</td> <td><span class="label label-md label-danger">rejected</span></td> <td>mr name 1 ahmed</td> <td>441254226688</td> <td>441254226688</td> <td><a href="mailto:zeeah@mail.co.uk">zeeah@mail.co.uk</a></td> <td>n/a</td> <td>5 (flat 12 ) temple street, <br />nelson, lanca's, bb95ss</td> <form method="post" action="/legalhq/public/admin/piclaimant.php" class="mysubmitclass" id="deleteform" > <td> <input type="hidden" name="hidden_pi_claimant_id" value="9"> <input type="hidden" name="hidden_case_id" value="1"> <input type="submit" name="edit" id="btnedit" class="btn purple btn-xs" value=" edit " /> </td> <td><input type="submit" name="delete" id="btndelete" class="btn red btn-xs myconfirm" value=" delete " /></td> </form> </td> </tr> <tr> <td>2</td> <td><span class="label label-md label-warning">submitted</span></td> <td>mr name 2 ahmed</td> <td>441254226688</td> <td>441254226688</td> <td><a href="mailto:zeeah@mail.co.uk">zeeah@mail.co.uk</a></td> <td>yes litigation</td> <td>5 (flat 2 ) temple street, <br />nelson, lanca's, bb95ss</td> <form method="post" action="/legalhq/public/admin/piclaimant.php" class="mysubmitclass" id="deleteform " > <td> <input type="hidden" name="hidden_pi_claimant_id" value="10"> <input type="hidden" name="hidden_case_id" value="1"> <input type="submit" name="edit" id="btnedit" class="btn purple btn-xs" value=" edit " /> </td> <td><input type="submit" name="delete" id="btndelete" class="btn red btn-xs myconfirm" value=" delete " /></td> </form> </td> </tr> <tr> <td>3</td> <td><span class="label label-md label-success">accepted , signed</span></td> <td>mr name 5 ahmed</td> <td>441254226688</td> <td>441254226688</td> <td><a href="mailto:zeeah@mail.co.uk">zeeah@mail.co.uk</a></td> <td>n/a</td> <td>33 temple street, <br />nelson, lanca's, bb95ss</td> <form method="post" action="/legalhq/public/admin/piclaimant.php" class="mysubmitclass" id="deleteform " > <td> <input type="hidden" name="hidden_pi_claimant_id" value="12"> <input type="hidden" name="hidden_case_id" value="1"> <input type="submit" name="edit" id="btnedit" class="btn purple btn-xs" value=" edit " /> </td> <td><input type="submit" name="delete" id="btndelete" class="btn red btn-xs myconfirm" value=" delete " /></td> </form> </td> </tr> <tr> <td>4</td> <td><span class="label label-md label-success">accepted</span></td> <td>mr name 7 ahmed</td> <td>441254226688</td> <td>441254226688</td> <td><a href="mailto:zeeah@mail.co.uk">zeeah@mail.co.uk</a></td> <td>n/a</td> <td>5 (flat 2 ) temple street, <br />nelson, lanca's, bb95ss</td> <form method="post" action="/legalhq/public/admin/piclaimant.php" class="mysubmitclass" id="deleteform " > <td> <input type="hidden" name="hidden_pi_claimant_id" value="13"> <input type="hidden" name="hidden_case_id" value="1"> <input type="submit" name="edit" id="btnedit" class="btn purple btn-xs" value=" edit " /> </td> <td><input type="submit" name="delete" id="btndelete" class="btn red btn-xs myconfirm" value=" delete " /></td> </form> </td> </tr> </tbody> </table> </div> </div>
jquery below:
$('.myconfirm').click(function(){ bootbox.confirm("are sure?", function(result) { alert("confirm result: "+result); // return (result) ? true : false; }); });
now i've amended code forms , data fake data though want delete record after confirm dialog box asked question.
bootbox works fine if not wrapped around <form>
tag, when inside, not work.i don't know issue.
any idea?
working fiddle fiddle
use following code:
$('.myconfirm').click(function(e){ e.preventdefault(); bootbox.confirm("are sure?", function(result) { // alert("confirm result: "+result); if(result==true){ $('form').submit(); } // return (result) ? true : false; }); });
in bootstrap ,check button on confirm box clicked? can either yes ,or no. if result yes submit form.but if user clicks on no/cancel .dont submit form.
Comments
Post a Comment