Przeglądaj źródła

Ticket #5412 - Forms: Alow to disable summary error message under submit button.

AntonLV 7 miesięcy temu
rodzic
commit
ddc7bc3cc6

+ 2 - 2
inc/classes/BxDolForm.php

@@ -1551,8 +1551,8 @@ class BxDolFormChecker
         }
 
         // add error message near submit button
-        if ($iErrors && $sSubmitName)
-            $aInputs[$sSubmitName]['error'] = _t('_sys_txt_form_submission_error');
+        if ($iErrors && $sSubmitName && !($this->_aFormParams['checker_errors']['summary']['disabled'] ?? false))
+            $aInputs[$sSubmitName]['error'] = _t($this->_aFormParams['checker_errors']['summary']['text'] ?? '_sys_txt_form_submission_error');
     
         return $iErrors ? false : true;
     }

+ 2 - 0
template/scripts/BxBaseFormAccount.php

@@ -135,6 +135,8 @@ class BxBaseFormAccount extends BxTemplFormView
         
         $this->_bSetPendingApproval = !(bool)getParam('sys_account_autoapproval');
 
+        $this->aParams['checker_errors']['summary']['disabled'] = true;
+
         if(($sField = 'picture') && isset($this->aInputs[$sField])) {
             /**
              * Note. For now Account Picture is available in edit form only. 

+ 2 - 0
template/scripts/BxBaseFormConfirmEmail.php

@@ -30,6 +30,8 @@ class BxBaseFormConfirmEmail extends BxTemplFormView
     public function __construct($aInfo, $oTemplate)
     {
         parent::__construct($aInfo, $oTemplate);
+
+        $this->aParams['checker_errors']['summary']['disabled'] = true;
     }
 
 }

+ 2 - 0
template/scripts/BxBaseFormConfirmPhone.php

@@ -51,6 +51,8 @@ class BxBaseFormConfirmPhone extends BxTemplFormView
     public function __construct($aInfo, $oTemplate)
     {
         parent::__construct($aInfo, $oTemplate);
+
+        $this->aParams['checker_errors']['summary']['disabled'] = true;
     }
 
 }

+ 2 - 0
template/scripts/BxBaseFormForgotPassword.php

@@ -69,6 +69,8 @@ class BxBaseFormForgotPassword extends BxTemplFormView
     public function __construct($aInfo, $oTemplate)
     {
         parent::__construct($aInfo, $oTemplate);
+
+        $this->aParams['checker_errors']['summary']['disabled'] = true;
     }
 
 }

+ 6 - 3
template/scripts/BxBaseFormLogin.php

@@ -51,8 +51,10 @@ class BxBaseFormLogin extends BxTemplFormView
     public function __construct($aInfo, $oTemplate)
     {
         parent::__construct($aInfo, $oTemplate);
-        $this->_aFieldsExcludeFromCheckForSpam = array("ID");
-        $aNoRelocatePages = array('forgot-password', 'login', 'create-account', 'logout');
+        
+        $this->aParams['checker_errors']['summary']['disabled'] = true;
+
+        $this->_aFieldsExcludeFromCheckForSpam = ['ID'];
 
         if (isset($this->aInputs['ID']))
             $this->aInputs['ID']['skip_domain_check'] = true;
@@ -62,7 +64,8 @@ class BxBaseFormLogin extends BxTemplFormView
             if (!$sRelocate && isset($_SERVER['HTTP_REFERER']) && 0 === mb_stripos($_SERVER['HTTP_REFERER'], BX_DOL_URL_ROOT)) {
 
                 $sRelocate = $_SERVER['HTTP_REFERER'];
-        
+                $aNoRelocatePages = ['forgot-password', 'login', 'create-account', 'logout'];
+
                 foreach ($aNoRelocatePages as $s) {
                     if (false !== mb_stripos($_SERVER['HTTP_REFERER'], $s)) {
                         $sRelocate = BX_DOL_URL_ROOT . 'member.php';