php - set values to fields in adminhtml form template -
i'd created template file admin form tab as:
class excellence_designer_block_adminhtml_designer_edit_tabs extends mage_adminhtml_block_widget_tabs { protected function _beforetohtml() { $this->addtab('images', array( 'label' => mage::helper('designer')->__('images'), 'title' => mage::helper('designer')->__('images'), 'content' => $this->getlayout()->createblock('designer/adminhtml_designer_edit_tab_images')->tohtml(), )); return parent::_beforetohtml(); } }
class excellence_designer_block_adminhtml_designer_edit_tab_images extends mage_adminhtml_block_template implements mage_adminhtml_block_widget_tab_interface { public function _construct() { parent::_construct(); $this->settemplate('designer/edit/tab/images.phtml'); } public function gettablabel() { return $this->__('images'); } public function gettabtitle() { return $this->__('images'); } public function canshowtab() { return true; } public function ishidden() { return false; } }
images.phtml
<div class="input-field"> <label for="image">custom field</label> <input type="text" class="input-text" name="image" id="image" /> </div>
but there's no value in there if want edit form
value saved in database. other tab created
mage_adminhtml_block_widget_form
, showing values in fields how value?
your editaction() has in way. check out.
public function editaction() { $newsid = $this->getrequest()->getparam('id'); $newsmodel = mage::getmodel('news/news')->load($newsid); if ($newsmodel->getid() || $newsid == 0) { $data = mage::getsingleton('adminhtml/session')->getformdata(true); if (!empty($data)) { $model->setdata($data); } mage::register('news_data', $newsmodel); $this->loadlayout(); $this->_setactivemenu('news/items'); $this->_addbreadcrumb(mage::helper('adminhtml')->__('item manager'), mage::helper('adminhtml')->__('item manager')); $this->_addbreadcrumb(mage::helper('adminhtml')->__('item news'), mage::helper('adminhtml')->__('item news')); $this->getlayout()->getblock('head')->setcanloadextjs(true); $this->_addcontent($this->getlayout()->createblock('news/adminhtml_news_edit')) ->_addleft($this->getlayout()->createblock('news/adminhtml_news_edit_tabs')); $this->renderlayout(); } else { mage::getsingleton('adminhtml/session')->adderror(mage::helper('news')->__('item not exist')); $this->_redirect('*/*/'); } }
Comments
Post a Comment