MDL-69608 core_form: frozen forms do not have form tag
[moodle.git] / theme / boost / amd / src / form-display-errors.js
index 230cbc5..a839184 100644 (file)
@@ -69,7 +69,7 @@ define(['jquery', 'core/event'], function($, Event) {
             });
 
             var form = element.closest('form');
-            if (!('boostFormErrorsEnhanced' in form.dataset)) {
+            if (form && !('boostFormErrorsEnhanced' in form.dataset)) {
                 form.addEventListener('submit', function() {
                     var visibleError = $('.form-control-feedback:visible');
                     if (visibleError.length) {