I’m creating a simple contact form within my ZF application. It doesn’t feel like it’s worth the trouble to manipulate decorators for only a few form elements.
My Question is: am I able to still use Zend Form Filters on elements that are not created with Zend Form:
For Example:
The Form:
<!-- Standard HTML - not generated with ZF -->
<form id="contact-form" method="post" action="/contact/submit">
<input type="text" name="name" />
<input type="email" name="email" />
<input type="submit" name="submit" />
</form>
The Controller:
public function submitAction()
{
$params = $this->_request->getParams();
//Am I able to apply filters/validators to the data I get from the request?
//What is the best way to handle this?
}
I took a look at this (the answer from Darcy Hastings) – and it seems like it would work, it just feels a bit hacky.
Any and all advice appreciated.
Thanks,
Ken
yes, you can use Zend_Filter_Input, here is an example of how to set it up.
also you may consider using the viewscript decorator to render a Zend Form, The control is absolute (or almost).: