craftpip / jquery-confirm

A multipurpose plugin for alert, confirm & dialog, with extended features.

Home Page:http://craftpip.github.io/jquery-confirm/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

$.confirm bug

SLey3 opened this issue · comments

jquery-confirm version:
v3.x.x

I'm submitting a ... (check one with "x")
[ x] bug report
[ ] feature request
[ ] support request

Current behavior:
The $.confirm function does not submit the form when the submit button is pressed like it is supposed to.

Expected behavior:
The $.confirm submits the form.

Steps to reproduce:

Related code:

    $(".blacklist").on('click', function() {
        $.confirm({
            title: 'Confirm Blacklist',
            draggable: false,
            columnClass: 'small',
            animation: 'rotateYR',
            closeAnimation: 'rotateXR',
            animationSpeed: 1500,
            content: '' +
                '<form id="blacklist-form" method="POST" action="{{ url_for("admin.adminAccountsUserManagement", user=user.name) }}">' +
                '<div class="form-group">' +
                '<label> Reason for Blacklist:</label>' +
                '{{ ext_options.reason }}' +
                '</div>' +
                '</form>',
            buttons: {
                formSubmit: {
                    text: 'Submit',
                    btnClass: 'btn-danger',
                    action: function() {
                        $.alert("Blacklist confirmed");
                        return true;
                    }
                },
                cancel: function() {},

            },
            onContentReady: function() {
                let jc = this;
                this.$content.find('form').on('submit', function(e) {
                    e.preventDefault();
                    jc.$$formSubmit.trigger('click');
                });
            }
        });
    });