Skip to main content
added 139 characters in body
Source Link
Mohammad Faisal
  • 1.1k
  • 2
  • 15
  • 36

I'd created a template file for 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 I do want to edit the form

screen shot even the value is saved in database. The other tab was created with Mage_Adminhtml_Block_Widget_Form and showing the values in fields but for this how could I get the value?

I'd created a template file for 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 I do want to edit the form

screen shot even the value is saved in database.

I'd created a template file for 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 I do want to edit the form

screen shot even the value is saved in database. The other tab was created with Mage_Adminhtml_Block_Widget_Form and showing the values in fields but for this how could I get the value?

Source Link
Mohammad Faisal
  • 1.1k
  • 2
  • 15
  • 36

set values to fields in adminhtml form template

I'd created a template file for 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 I do want to edit the form

screen shot even the value is saved in database.