What's new

Closed Javascript Confirm not working

Status
Not open for further replies.

Tomanz

Forum Veteran
Joined
Dec 22, 2015
Posts
985
Reaction
351
Points
608
Age
24
Guys bakit pumupunta parin sa true kahit cancel pinipindot ko sa confirm box ? at nagdedete parin yung data sa data base kahit cancel pinidot ko... pa help po ...
Thank you in Advance.

<script>
function mydelete() {
var txt;
var r = confirm("Do you want to Delete this?");
if (r == true) {
alert("Deletion Success!");
url: 'delete.php';
} else {
alert("Deletion Canceled");
}
}
</script>
 
Last edited:
halagao72

working naman.

if ayaw pa din, try


JavaScript:
function mydelete() {
    var txt;
    var r = confirm("Do you want to Delete this?");
    
    if (r) {
        alert("Deletion Success!");
        url: 'delete.php';
    } else {
        alert("Deletion Canceled");
    }
}
 
Tama naman ah...

JavaScript:
<script>

  const deleteMe = () => {

    const r = confirm("Do you want to Delete this?");
  
    if (r) {
        alert("Deletion Success!");
    } else {
        alert("Deletion Canceled");
    }

  }

  deleteMe();

</script>
 
halagao72

working naman.

if ayaw pa din, try


JavaScript:
function mydelete() {
    var txt;
    var r = confirm("Do you want to Delete this?");
  
    if (r) {
        alert("Deletion Success!");
        url: 'delete.php';
    } else {
        alert("Deletion Canceled");
    }
}
I mean nagdedelete po yung data kahit na napindot yung cancel button kasi naka data base po ako haha
 
Tama naman ah...

JavaScript:
<script>

  const deleteMe = () => {

    const r = confirm("Do you want to Delete this?");
 
    if (r) {
        alert("Deletion Success!");
    } else {
        alert("Deletion Canceled");
    }

  }

  deleteMe();

</script>
I mean nagdedelete po yung data kahit na napindot yung cancel button kasi naka data base po ako haha
 
I mean nagdedelete po yung data kahit na napindot yung cancel button kasi naka data base po ako haha
láρág mo full code mo. Tama naman yung logic niyan

1575355045284.png
 

Attachments

I mean nagdedelete po yung data kahit na napindot yung cancel button kasi naka data base po ako haha
Yong question mo kasi iba sa reply mo hehehe. Mas ok siguro kung SPECIFIC yong tanong with screenshots. Wala namang logic doun sa false. Baka message alert lang na nag de-delete siya?
 
The reason why your code still does a delete is because somewhere in your codebase is you are STILL calling the delete where it shouldn't be called in the first place.

But I'm sure the delete is NOT being called in the code snippet you posted above. The true bug here is you don't have full understanding of your codebase here since you don't know where delete is supposed to be called.
 
Tawagin mo yung API mo na mag dedelete kung nag `true` yung confirmation mo.

JavaScript:
(function() {
  if (confirm('Delete confirmation message')) {
    console.log('true');
    // call delete API here
  }
})();
 
Last edited:
Tawagin mo yung API mo na mag dedelete kung nag `true` yung confirmation mo.

JavaScript:
(function() {
  if (confirm('Delete confirmation message')) {
    console.log('true');
    // call delete API here
  }
})();
master pano pag gusto ko lang lumabas to pag napindot yung delete button.
 
try mo

HTML:
<button onclick="return myDelete()">Delete</button >

function myDelete() {
        var r = confirm("Do you want to Delete this?");
        if (r) {
            console.log('Delete Success');
             // execute code
            return false;
        } else {
             // execute code
            return false;
        }
    }
 
try mo

HTML:
<button onclick="return myDelete()">Delete</button >

function myDelete() {
        var r = confirm("Do you want to Delete this?");
        if (r) {
            console.log('Delete Success');
             // execute code
            return false;
        } else {
             // execute code
            return false;
        }
    }
cge boss try ko
 
try mo

HTML:
<button onclick="return myDelete()">Delete</button >

function myDelete() {
        var r = confirm("Do you want to Delete this?");
        if (r) {
            console.log('Delete Success');
             // execute code
            return false;
        } else {
             // execute code
            return false;
        }
    }
cge boss try ko maraming salamat
 
Status
Not open for further replies.

Similar threads

Back
Top