Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

view helper validation

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?

like image 701
Damian Crawford Avatar asked Dec 31 '25 18:12

Damian Crawford


1 Answers

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'.

like image 119
vascowhite Avatar answered Jan 02 '26 10:01

vascowhite



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!