I've searched internet and there is no official documentation for applying input filters to arrays in ZF3.
I have seen answers for ZF2, Zend Framework 2 filter / validate array of contents
Can anyone help out how to apply input filters to array of input.
This is my form class
class ContactForm extends Form
{
public function __construct($name = null)
{
// we want to ignore the name passed
parent::__construct("contactForm");
$this->addInputFilters();
}
public function init()
{
$this->add([
"name" => "Type[]",
"type" => "text",
"attributes" => [
"class" => "form-control",
],
]);
}
private function addInputFilters() {
$inputFilter->add([
"name" => "Type[]",
"required" => true,
"filters" => [],
"validators" => [
[
"name" => "StringLength",
"options" => [
"min" => 3,
"max" => 100,
],
],
],
]);
}
(new InputFilterClass())->setData(['dataKey'=>'dataValue'])->isValid()?