jqh 5 år sedan
förälder
incheckning
fa0d5cab03
2 ändrade filer med 17 tillägg och 13 borttagningar
  1. 17 0
      src/Form/Concerns/HasFieldValidator.php
  2. 0 13
      src/Form/Field/Text.php

+ 17 - 0
src/Form/Concerns/HasFieldValidator.php

@@ -410,4 +410,21 @@ trait HasFieldValidator
     }
 
 
+    /**
+     * Set error messages for individual form field.
+     *
+     * @see http://1000hz.github.io/bootstrap-validator/
+     *
+     * @param string $error
+     * @param string $key
+     * @return $this
+     */
+    public function setClientValidationError(string $error, string $key = null)
+    {
+        $key = $key ? "{$key}-" : '';
+
+        return $this->attribute("data-{$key}error", $error);
+    }
+
+
 }

+ 0 - 13
src/Form/Field/Text.php

@@ -118,19 +118,6 @@ JS
         ]);
     }
 
-    /**
-     * Set error messages for individual form field.
-     *
-     * @see http://1000hz.github.io/bootstrap-validator/
-     *
-     * @param string $error
-     * @return $this
-     */
-    public function validationError(string $error)
-    {
-        return $this->attribute('data-error', $error);
-    }
-
     /**
      * Add inputmask to an elements.
      *