RickyHalim
RickyHalim

Reputation: 295

Boxy this submit does not work

I have several forms in my code, and I want to assign a Confirmation Box to show before it is submitted.

Hence, I use Boxy Jquery, however after the user confirms, $(this).submit() does not work. Is this because there are more than 1 form?

Here is my JS:

$("form").submit(function(ev) {
        Boxy.confirm("Are you sure?", function() { $(this).submit(); }, {title: 'Confirm'});
        return false;

});

Upvotes: 0

Views: 50

Answers (2)

Alok Ranjan
Alok Ranjan

Reputation: 100

If you have a submit button that triggers the form submit, you can do something like this:

$(".button").click(function(ev) {
    ev.preventDefault();
    Boxy.confirm("Are you sure?", function() { $('form').submit(); }, {title: 'Confirm'});
});

Upvotes: 0

vaneayoung
vaneayoung

Reputation: 363

   $("form").submit(function(ev) {
        var $this = jQuery(this);
        Boxy.confirm("Are you sure?", function() { $this.submit(); }, {title: 'Confirm'});
        return false;

});

Upvotes: 0

Related Questions