bootstrap
bootstrap copied to clipboard
Error when reseting form
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!
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