Skip to content

Commit

Permalink
Merge pull request #3 from vinc10/fix-ufalerts-initialization
Browse files Browse the repository at this point in the history
Fix: Ensure ufAlerts is initialized in ufForm _defaultError method
  • Loading branch information
lcharette authored Nov 30, 2024
2 parents 72c268c + 8c84075 commit 9b416b9
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion app/assets/userfrosting/js/uf-form.js
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,10 @@
*/
Plugin.prototype._defaultError = function (jqXHR, textStatus, errorThrown) {
// Error messages
if (!this.settings.msgTarget.data('ufAlerts')) {
this.settings.msgTarget.ufAlerts();
}

if (this._debugAjax && jqXHR.responseText) {
this.$element.trigger('submitError.ufForm', [jqXHR, textStatus, errorThrown]);
this.settings.msgTarget.ufAlerts('push', 'danger', jqXHR.responseJSON.description).ufAlerts('render');
Expand Down Expand Up @@ -428,4 +432,4 @@
console.warn('Method ' + methodOrOptions + ' does not exist.');
}
};
})(jQuery, window, document);
})(jQuery, window, document);

0 comments on commit 9b416b9

Please sign in to comment.