Hello,

I'm using a Zend_Filter_Input to get my data from the user.

I'm not correctly understanding its behavior with missing fields (zf 1.0.0),

here is some code:

$filters = array(
       'description'   => array('StringTrim', 'HtmlEntities'),
       'upload' => 'StringTrim',
       'whateverwrongvalue' => 'StringTrim',
       'review' => 'Int'
   );
   $validators = array(
       'description'   => 'NotEmpty',
       'upload' => 'NotEmpty',
       'whateverwrongvalue' => 'NotEmpty',
       'review' => array(array('Between', 0, 1))
   );
   $input = new Zend_Filter_Input($filters, $validators, $_POST);
   if ($input->hasInvalid() || $input->hasMissing()) {
       format_error_message($input->getInvalid(),
$input->getMissing(), $input->getUnknown());
   }

I then create a form which contains all these fields except
'whateverwrongvalue' (aka, it should be reported as a missing field if
I get it).

Problem is, it isn't. If some field (say, 'description') is invalid,
the 'if' fails and I get a valid error message etc ...

But I never get anything about a missing field

(unknown fields are reported the way they should be)

Is it me misunderstanding the behavior or did I do something wrong ?

--
Vianney Devreese - Lepidosteus
http://lepidosteus.com

Reply via email to