Can I use my normal (html) form in Zend Framework ? How can I do that & How can I call action in IndexController file?
+1
A:
of course you can ... just use
<form action="/index/action" methode="POST">
to access post arguments use
$this->getRequest()->getParam('argument')
roman
2010-01-28 10:33:10
Yes! I tried. This is working fine.Thanx!
Sadee
2010-01-28 11:30:23
A:
Yes, I have a module called 'contact', and an action addcontactAction()
in the ContactController.php.
So I can use : /view/scripts/contacts/addcontact.phtml
<form action="" method="post" name="frm_addcontact" />
<input name="cn_fname" type="text" class="textbox" id="cn_fname"/>
<input type="submit" class="button" id="save" value="Save" />
</form>
when this form is submitted, it calls addcontactAction()
in the controller.
$cn_fname = $_REQUEST['cn_fname'];
Sadee
2010-01-28 11:45:57
+1
A:
Hi,
thats no problem, put your form code inside the view script for the associated action. Maybe:
formAction()
{
// check if post request
if ($this->getRequest()->isPost()) {
// read global $_POST array
$data = $this->getRequest()->getPost();
}
}
the associated view ist than form.phtml
ArneRie
2010-01-28 11:47:05
+1
A:
Yes, definitely.. You just have to remove the isValid call in your controller since it won't be performing any validation and also remove the post request check if it will not contain any form. It's like creating a common view with simple links in it.
Hanseh
2010-04-07 04:51:48