The more I dig around and play with it, the more I think it may be a small ZF
bug.

Basically, I couldn't figure out what was happening, so I had the update
function just print out the result of the validation:
******
       public function update(array $data, $where) {
               $valid = $this->isValidGeneral($data);
               if($valid===true) {
                       print("TRUE");
               }
               else {
                       print_r($valid);
               }
       }
*****
$valid is either going to be TRUE or the result of the getMessages()
function from my isValidGeneral() function:

*****
        protected function isValidGeneral(array $data, $options=null) {
                $input = new
Zend_Filter_Input($this->_filters,$this->_validators,$data,$options);

                if($input->hasInvalid()){
                        return $input->getMessages();
                } 
               ....
****
When I put something like "O'brien" in as field1 (alpha validator) it is
invalid and returns the getMessages result, but when i try to print it out
(or access the getMessages element holding the error message), all I get is:

Array ( [lname] => Array ( [notAlpha] => '

and the page completely stops processing anything after the (') at the end
of that line (same thing happens if I try to just print out the element that
contains the (').  If I don't try to access/print out that element of the
result of getMessages() everything runs, but then I can't print out the
message.  I can override the standard message with something like:

'field1' =>
array('Alpha','messages'=>array(Zend_Validate_Alpha::NOT_ALPHA=>'Last name
must be letters only')),

and that works fine.  That said, I'd prefer to use the ZF standard message
when possible.  Even if it worked, I'd be outta luck with a (') passing
validation.  Do you know if the following syntax is correct for the regex
validator:

protected $_validators = array(
                'field1' => array('regex',true,array('/[^a-zA-Z\'\-\ ]/'),
                .....
              );
?
I've been getting that 'Missing argument 1...' error.



A.J. Brown-3 wrote:
> 
> Hmm,
> 
> When you say "screetching to a halt", what actually happens? Is an
> exception
> thrown?  The validators will return true or false, and filters will
> returned
> the filtered content.
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/getMessages%28%29-crashes-with-quotes%21-tp21793751p21799371.html
Sent from the Zend Framework mailing list archive at Nabble.com.

Reply via email to