views:

58

answers:

2

Is there any way to output all filtered data from the class Zend_Filter_Input?

A: 

In form you can get unfiltered values. Check the manual ;)

Tomáš Fejfar
Sorry I have made a mistake. I need to get an array storing all filtered data.
Alan
$form->getValues(); :P
Tomáš Fejfar
+2  A: 

Zend_Filter_Input offers numerous methods for retrieving filtered and validated data. First, you can retrieve an associative array of all fields:

$data = $input->getEscaped(); // Retrieve all data, escaped with Zend_Filter_HtmlEntities
$data = $input->getUnescaped(); // Retrieve all data, not escaped.

You can also get an associative array of certain segments of you data, the method names are very clear:

  $invalidFields = $input->getInvalid(); // Fields that failed validation

  $missingFields = $input->getMissing(); // Fields that were declared as 'required' using the 'presence' metacommand, but not in the input

  $unknownFields = $input->getUnknown(); // Fields that were not declared in the validator rules, but were present in the input.

On top of all that, Zend_Filter_Input offers an object accessor, through an implementation of the __get magic method:

$oneField = $input->oneFieldName
jason