Hi all. I have this validator:

class validator_selectChoice  extends Zend_Validate_Abstract
{
   const SELECTCHOICE = 'selectChoice';

   /*
* Rappresenta il valore di default che non deve essere quello scelto dall'utente.
    */
   private $_errorValue;
   protected $_messageTemplates = array(
       self::SELECTCHOICE => "You need to choice a value"
   );

   public function __construct($err = 0) {
       $this->_errorValue = $err;
   }
public function isValid($value)
   {
       $this->_setValue($value);
       var_dump("E: $this->_errorValue");
       var_dump("V: $value");
       if ($value == $this->_errorValue) {
           var_dump("iF!!!!!!!!!!!!!!!!!!!!");
           $this->_error();
           return false;
       }

       return true;
   }
}

This is the debug log (via var_dump output)

string 'E: 0' /(length=4)/

string 'V: AR' /(length=5)/

string 'iF!!!!!!!!!!!!!!!!!!!!' /(length=22)/

string 'E: 0' /(length=4)/

string 'V: 5' /(length=4)/

string 'E: 0' /(length=4)/

string 'V: 1' /(length=4)/


Why '0' == ' AR' is true ?

Tnx.

--
Michel 'ZioBudda' Morelli                       mic...@ziobuddalabs.it
Consulenza sistemistica in ambito OpenSource.
Sviluppo applicazioni web dinamiche (LAMP+Ajax)
Telefono: 0200619074
Telefono Cell: +39-3939890025 --  Fax: +39-0291390660

http://www.ziobudda.net ICQ: 58351764 http://www.ziobuddalabs.it Skype: zio_budda http://www.ajaxblog.it MSN: mic...@ziobuddalabs.it JABBER: mic...@gmail.com

Reply via email to