Hi,
try setting the presence required option via the global options, not
fieldwise. This works just fine for me.
Cheers,
Sascha
pcalkins schrieb:
> Hi Sascha,
>
> Trying your suggestion did not seem to change anything. I am still getting
> the same symptoms - while the validation fails (as expected), none of the
> "presence_required" fields that are missing are showing up in the
> getErrors() method. Am I missing something or is this the correct behavior?
>
> Thanks-
> Patrick Calkins
>
>
> Sascha Göbel wrote:
>> Hi Patrick,
>>
>> you'll have to enable the "all fields are required" feature via the
>> options first:
>>
>> $options = array(Zend_Filter_Input::PRESENCE =>
>> Zend_Filter_Input::PRESENCE_REQUIRED);
>> $filteredInput->setOptions($options);
>>
>> Cheers,
>> Sascha
>>
>> pcalkins schrieb:
>>> I posted this to core, but doesn't seem like many are subscribed to that
>>> - so
>>> I am trying this list instead. Forgive me if its the wrong list :)
>>>
>>> Code:
>>>
>>> $input = array('customerId' => 3);
>>>
>>> $filters = array(
>>> 'customerId' => 'Digits',
>>> '*' => array(
>>> array('Alnum', true),
>>> 'StringTrim'
>>> )
>>> );
>>> $validators = array(
>>> '*' => array(
>>> 'allowEmpty' => true
>>> ),
>>> 'customerId' => array(
>>> 'presence' => 'required',
>>> array('GreaterThan', 0)
>>> ),
>>> 'description' => array(
>>> 'presence' => 'required'
>>> )
>>> );
>>>
>>> $filteredInput = new Zend_Filter_Input($filters, $validators, $input);
>>>
>>> print_r($filteredInput->getErrors());
>>> print_r($filteredInput->getMissing());
>>>
>>> I would think that an error about the missing 'description' field would
>>> be
>>> contained in the getErrors() method, but it is not. You have to use
>>> getMissing() to find out, which contains a detailed message as opposed to
>>> the shorter error messages available in getErrors(). Is this the correct
>>> behavior??
>>>
>>> Thanks-
>>> Patrick Calkins
>>>
>>
>