Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when reseting form #570

Open
davidwwu opened this issue Nov 14, 2017 · 1 comment
Open

Error when reseting form #570

davidwwu opened this issue Nov 14, 2017 · 1 comment
Milestone

Comments

@davidwwu
Copy link

I followed the doc to setup a fileupload component with image preview and while data-dismiss works fine, clicking a type="reset" button throws two types of error:

jquery-3.2.1.min.js:2 Uncaught RangeError: Maximum call stack size exceeded
    at Function.each (jquery-3.2.1.min.js:2)
    at r.fn.init.each (jquery-3.2.1.min.js:2)
    at r.fn.init.val (jquery-3.2.1.min.js:4)
    at c.clear (jasny-bootstrap.min.js:6)
    at c.reset (jasny-bootstrap.min.js:6)
    at HTMLFormElement.e (jquery-3.2.1.min.js:2)
    at HTMLFormElement.dispatch (jquery-3.2.1.min.js:3)
    at HTMLFormElement.q.handle (jquery-3.2.1.min.js:3)
    at Object.trigger (jquery-3.2.1.min.js:4)
    at HTMLDivElement.<anonymous> (jquery-3.2.1.min.js:4)

and

jquery-3.2.1.min.js:3 Uncaught SyntaxError: Invalid regular expression: /(^|\.)bs\.(?:.*\.|)fileinput(\.|$)/: Stack overflow
    at RegExp.test (<anonymous>)
    at HTMLFormElement.dispatch (jquery-3.2.1.min.js:3)
    at HTMLFormElement.q.handle (jquery-3.2.1.min.js:3)
    at Object.trigger (jquery-3.2.1.min.js:4)
    at HTMLDivElement.<anonymous> (jquery-3.2.1.min.js:4)
    at Function.each (jquery-3.2.1.min.js:2)
    at r.fn.init.each (jquery-3.2.1.min.js:2)
    at r.fn.init.trigger (jquery-3.2.1.min.js:4)
    at c.reset (jasny-bootstrap.min.js:6)
    at HTMLFormElement.e (jquery-3.2.1.min.js:2)

Thanks in advance!

@zohaibhassan156
Copy link

zohaibhassan156 commented Sep 29, 2018

I get the same issue on resetting form by jquery validation after a pop close

$('#btn-add-new').click(function (e) {
    $.magnificPopup.open({
        items: {
            src: '#modalForm'
        },
        type: 'inline',
        fixedContentPos: false,
        fixedBgPos: true,
        overflowY: 'auto',
        closeBtnInside: true,
        preloader: false,
        midClick: true,
        removalDelay: 300,
        mainClass: 'my-mfp-zoom-in',
        showCloseBtn: true,
        modal: true,
        callbacks: {
            afterClose: function () {
                validator.resetForm();
                //Maximum call stack size exceeded error 
            }
        }
    });
});

I had commented this line https://github.com/jasny/bootstrap/blob/master/js/fileinput.js#L287
and now its work fine

Can't get why he is listening to his own event at https://github.com/jasny/bootstrap/blob/master/js/fileinput.js#L63

and calling a function in which he again generating the same event. at https://github.com/jasny/bootstrap/blob/master/js/fileinput.js#L287

@jasny jasny added this to the v4 :heart: milestone Sep 24, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants