views:

24

answers:

1

I'm using zend form in a non-zend project and I'm able to access Zend_Form fine from my custom class Custom_Form. Then in the file where I want to render my form, I create an instance of my form, but then I'm not sure how to render it.

$form = new Custom_Form();
//how to render the form here
var_dump($form); //var_dump looks busy so couldn't find info from it
+2  A: 

This should work, you need an view script and than call the render(); method.

$view = new Zend_View();
$view->doctype('XHTML1_TRANSITIONAL');

$form = new Custom_Form();
$form->setView(new Zend_View());

echo $form->render();
ArneRie
thank you. By the way I used `setView($view)` instead of creating a `setView(new Zend_View())` to take advantage of the `doctype` above. So what's the purpose of this doctype? since it works just fine without it.
Berming