I'm trying to test fom component. There is my code:
$form = new \Phalcon\Forms\Form();
$field = new \Phalcon\Forms\Element\Text("name");
$field->addValidator(
new \Phalcon\Validation\Validator\PresenceOf(
array(
'message' => 'The name is required'
)
)
);
var_dump($field);
$form->add($field);
and output:
object(Phalcon\Forms\Element\Text)#2 (2) {
["_name":protected]=>
string(4) "name"
["_validators":protected]=>
NULL
}
it looks like validator can't be added and as result $form->isValid() always returns false.
Please advise.