I have read through the forums and tried for several hours now to get a
simple viewscript to work - I am still unable to get a form element to
render. Hopefully someone can offer some advice:
My Controller:
<?php
class Orders_OrderdetailController extends Zend_Controller_Action{
public function preDispatch(){
$this->_helper->layout->disableLayout();
}
public function indexAction(){
...
$form = new OrderDetailForm();
$form->populate($orderData[0]);
$this->view->form = $form;
...
}
}
class OrderDetailForm extends Zend_Form{
public function init(){
$this->addElement('text', 'ORDER_NUMBER', array(
'label' => 'Order Number'
));
//$ORDER_NUMBER = new Zend_Form_Element_Text('ORDER_NUMBER');
//$ORDER_NUMBER->setLabel('Order Number');
//$this->addElement($ORDER_NUMBER);
$this->setDecorators(array(array('viewScript', array('viewScript' =>
'orderdetail/orderdetailform.phtml'))));
}
}
_____________________________________________________________________________
My index.phtml view script:
<h1>Test View Order</h1>
<?php echo $this->form; ?>
_____________________________________________________________________________
My orderdetailform.phtml view script:
<?php
foreach ($this->element as $item) {
$item->setView($this);
echo "Setting View<br>";
}
?>
<form>
<h2>Order Detail Form</h2>
<?php echo $this->ORDER_NUMBER; ?>
</form>
__________________________________________________________________
Can a skilled eye see what's wrong - I have tried so many variations of this
and have yet to see a text input element render...
Thanks in advance!
--
View this message in context:
http://www.nabble.com/Zend-Form-ViewScript-Not-Working-tp19980420p19980420.html
Sent from the Zend Framework mailing list archive at Nabble.com.