ZF Manual on View Helpers
According to the above link I can create a form element in the view like so
echo $this->formText($name, $value, $attribs);
However how would I apply validation or does this need to be done in the controller using the validator component?
If you did this:-
<form action='/login'>
echo $this->formText($name, $value, $attribs);
echo $this->formSubmit($name, $value, $attribs);
</form>
Then you would carry out the validation in the indexAction of your login controller using the validators available in Zend Validate.
Using this method you probably won't have a form object and I wouldn't really recommend using it unless you really don't like Zend Form.
So, basically that was just a long winded way of saying 'Yes this needs to be done in the controller using the validator component'.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With