hi there, here i have the form model’s element definition like this:
class ContactForm extends Form
{
public function __construct($name = null)
{
parent::__construct('contactform');
$this->setAttribute('method','POST');
$this->addElements();
$this->addInputFilter();
}
private function addElements()
{
$this->add([
'type'=>'text',
'name'=>'fname',
'attributes'=>
[
'placeholder'=>'firstname',
'class'=>'form-control',
]
]);
}
private function addInputFilter()
{
$inputfilter = new InputFilter();
$this->setInputFilter($inputfilter);
$inputfilter->add([
'name'=>'fname',
'required'=>true,
'filters'=>
[
['name'=>'StripTags'],
['name'=>'StringTrim'],
],
'validators'=>
[
[
'name'=>'StringLength',
'options'=>
[
'encoding'=>'UTF-8',
'min'=>1,
'max'=>20,
],
],
],
]);
}
}
i got all other things prepared like Controller and View.
the problem is when I try submit this form with bunch of numbers instead of strings and in my surprise there is no filter or validation error in return and the form is submitted despite using
'type' => 'text'
inside my field definition.
what am I to do now?