setAlert(type, message, options) {
        if (!type && this.submitted) {
            if (this.alert) {
                if (this.refs.errorRef && this.refs.errorRef.length) {
                    this.refs.errorRef.forEach((el) => {
                        this.removeEventListener(el, 'click');
                        this.removeEventListener(el, 'keypress');
                    });
                }
                this.removeChild(this.alert);
                this.alert = null;
            }
            return;
        }
        if (this.options.noAlerts) {
            if (!message) {
                this.emit('error', false);
            }
            return;
        }
        if (this.alert) {
            try {
                if (this.refs.errorRef && this.refs.errorRef.length) {
                    this.refs.errorRef.forEach((el) => {
                        this.removeEventListener(el, 'click');
                        this.removeEventListener(el, 'keypress');
                    });
                }
                this.removeChild(this.alert);
                this.alert = null;
            } catch (err) {
                // ignore
            }
        }
        if (message) {
            const attrs = {
                class: (options && options.classes) || `alert alert-${type}`,
                id: `error-list-${this.id}`,
            };

            const templateOptions = {
                message: message instanceof HTMLElement ? message.outerHTML : message,
                attrs: attrs,
                type,
            };

            this.alert = convertStringToHTMLElement(
                this.renderTemplate('alert', templateOptions),
                `#${attrs.id}`
            );
        }
        if (!this.alert) {
            return;
        }

        this.loadRefs(this.alert, { errorRef: 'multiple' });

        if (this.refs.errorRef && this.refs.errorRef.length) {
            this.refs.errorRef.forEach((el) => {
                this.addEventListener(el, 'click', (e) => {
                    const key = e.currentTarget.dataset.componentKey;
                    this.focusOnComponent(key);
                });
                this.addEventListener(el, 'keydown', (e) => {
                    if (e.keyCode === 13) {
                        e.preventDefault();
                        const key = e.currentTarget.dataset.componentKey;
                        this.focusOnComponent(key);
                    }
                });
            });
        }
        this.prepend(this.alert);
    }
Sets a new alert to display in the error dialog of the form.
@param {string} type - The type of alert to display. 'danger', 'success', 'warning', etc.
@param {string} message - The message to show in the alert.
@param {object} options - The options for the alert.