[REF] Ensure that our custom error handler is called when jquery validates and expand...
authorSeamus Lee <seamuslee001@gmail.com>
Sat, 20 Jun 2020 11:54:31 +0000 (21:54 +1000)
committerSeamus Lee <seamuslee001@gmail.com>
Sat, 20 Jun 2020 11:54:31 +0000 (21:54 +1000)
js/Common.js
templates/CRM/common/l10n.js.tpl

index b1eba2836eac28347c39a6d2dcc2de1c7b18b3bb..0199e80eb1c5c37574a5699cbf4b8acd53f69f3d 100644 (file)
@@ -882,6 +882,8 @@ if (!CRM.vars) CRM.vars = {};
       var validator = $(this).validate();
       var that = this;
       validator.settings = $.extend({}, validator.settings, CRM.validate._defaults, CRM.validate.params);
+      // Call our custom validation handler.
+      $(validator.currentForm).on("invalid-form.validate", validator.settings.invalidHandler );
       // Call any post-initialization callbacks
       if (CRM.validate.functions && CRM.validate.functions.length) {
         $.each(CRM.validate.functions, function(i, func) {
index 023edfa3a64b3655507956badac9c9a4d452b5cc..60b4f223ad934a1a4ea18e3f7fe914c8f4ddb778 100644 (file)
     // but there will be no overall message. Currently the container is only available on backoffice pages.
     if ($('#crm-notification-container').length) {
       $.each(validator.errorList, function(k, error) {
+        $(error.element).parents('.crm-custom-accordion.collapsed').crmAccordionToggle();
         $(error.element).crmError(error.message);
       });
     }