I find the following error:
<form action="" method="post" onsubmit="sweetalert(1)">
Dados aqui !!!
<input type="button" id="selectall-game-button" label="check all" value="Selecionar tudo">
<input type="submit" id="delete-game-button" value="Eliminar" style="display:none;"/>
JS
function sweetalert(x) {
switch (x) {
case 1:
swal({
title: "Aviso!",
text: "Tens a certeza que queres apagar este/s ficheiro/s?",
type: "warning",
showCancelButton: true,
confirmButtonColor: "#DD6B55",
confirmButtonText: "Sim, eliminar!",
cancelButtonText: "Não, cancelar!",
closeOnConfirm: false,
closeOnCancel: false
}, function(isConfirm) {
if (isConfirm) {
swal("Eliminado!", "O/s ficheiro/s foi/foram eliminado/s!", "success");
} else {
swal("Cancelado", "A operação foi cancelada, os ficheiros foram salvos!", "error");
}
});
break;
}
}
I already tested with the alert and confirm in the onsubmit and everything went well. But when I put this script in onsubmit
it does not "lock" the function, it deletes the data before confirming whether or not I want to delete the file.