From a1a0b2e099555f432b17217cf061c46ea41e5662 Mon Sep 17 00:00:00 2001 From: Camael24 Date: Fri, 1 Mar 2013 13:53:26 +0100 Subject: [PATCH] Ajout de getValidation, pour savoir quel champ est invalide en cas de validation manuelle --- Interpreter/Html/Form.php | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/Interpreter/Html/Form.php b/Interpreter/Html/Form.php index defa5ba..82f3405 100644 --- a/Interpreter/Html/Form.php +++ b/Interpreter/Html/Form.php @@ -77,6 +77,7 @@ * * The
component. * + * @author Julien Clauzel * @author Ivan Enderlin * @copyright Copyright © 2007-2013 Ivan Enderlin. * @license New BSD License @@ -138,6 +139,7 @@ class Form extends Generic implements \Hoa\Xyl\Element\Executable { protected static $_interpreter = null; + protected $_validation = array(); /** @@ -429,7 +431,9 @@ public function isValid ( $revalid = false ) { $handle = $handle && $verdict; }); - + + $this->setValidation($validation); + self::postVerification($this->_validity, $this); if(true === $this->_validity) @@ -632,6 +636,34 @@ public static function getMe ( Concrete $element ) { return $form[0]; } + + /** + * Get element's validation array + * + * @access public + * @return Array + */ + public function getValidation () { + + return $this->_validation; + } + + /** + * Set element's validation array + * + * @access public + * @param Array $validation Validation + * @return Array + */ + public function setValidation ( $validation ) { + + $old = $this->getValidation(); + $this->_validation = $validation; + + return $old; + } + + } }