Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Javascript confirm box

Tags:

javascript

i try to use confirm box but it does not work after 'OK' pressing this is my confirm box

<script language="JavaScript">
{literal}
function confirmBox()
{
 var where_to= confirm("Silmek istediğinizden emin misiniz?");
 if (where_to== true)
     return true;
 else{
     alert("Silme işleminden vazgeçtiniz yönlendiriliyorsunuz");
     return false;
 }
}
{/literal}
</script>



 <form name="removeFortune" method="post" action="#">
    <table border="0" name="tableArticle">
     {foreach from=$articles value=article}
        <tr>
            <td><input type="checkbox" name="checkArticle[]" value="{$article.id}" /></td>
            <td>{$article.title}</td>
        </tr>
        {/foreach}
    </table>
    <input type="submit" onclick="confirmBox()" name="removeArticle" value="Sil" />
    <br /><br />

    {$deleteMessage}

</form>
like image 904
snnlankrdsm Avatar asked Jul 28 '26 03:07

snnlankrdsm


1 Answers

If you want it to submit after pressing OK, you need to change 1 simple thing. Add a return

onclick="return confirmBox()"

Although I would say:

onsubmit="return confirmBox()"
like image 142
Rene Pot Avatar answered Jul 29 '26 16:07

Rene Pot



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!