paralosreg
paralosreg

Reputation: 160

Each button click require one click more in cancel

I have a problem. Each time I click in Confirmation 'Cancel', the next time needs one more click to close dialog.

$('.boton-estado').unbind().click(function () {
$('#id_estado').val($(this).val());
$("#estados").submit(function (event) {
    if (!confirm("¿Realizar cambio de estado?")) {
        event.preventDefault();
        event.stopPropagation();
    }
});
$("#estados").submit();
});

Ideas? Thx

Upvotes: 0

Views: 50

Answers (1)

Bhushan Kawadkar
Bhushan Kawadkar

Reputation: 28523

Try this: put submit button handler outside the button handler

$(function(){
$('.boton-estado').unbind().click(function () {
$('#id_estado').val($(this).val());
$("#estados").submit();
});

$("#estados").submit(function (event) {
    if (!confirm("¿Realizar cambio de estado?")) {
        event.preventDefault();
        event.stopPropagation();
    }
});
});

Upvotes: 1

Related Questions