My class extends from Mage_Adminhtml_Block_Widget_Form
, which has declaration for _prepareForm
method with code for myfield
as follows
$fieldset->addField('myElementId', 'link', array(
'label' => 'myLabel',
'href' => 'http://magento.stackexchange.com',
'value' => 'myElementValue'
));
This field is rendering all except value
(i.e, myElementValue).
Can any one help me with this?
Billions of Thanks in Advance
EDIT:
My class name - MyNameSpace_MyModule_Block_Adminhtml_MyBlockGroup_ClassExtendingFormContainer_Tab_Form
This class defines the _prepareForm function as follows:
protected function _prepareForm()
{
$form = new Varien_Data_Form();
$this->setForm($form);
$fieldset = $form->addFieldset('someElementId',array('key'=>'value'));
$fieldset->addField('myElementId', 'link', array(
'label' => 'myLabel',
'href' => 'http://magento.stackexchange.com/',
'value' => 'myElementValue',
));
$fieldset->addField('myElementId2', 'text', array(
'label' => 'myLabel2',
'name' => 'myElementId2',
));
$dateFormatIso = Mage::app()->getLocale()->getDateTimeFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT);
$fieldset->addField('myElementId3', 'date', array(
'name' => 'myElementId3',
'label' => 'myLabel3',
'width'=>"100px",
'image' => $this->getSkinUrl('images/grid-cal.gif'),
'input_format' => Varien_Date::DATE_INTERNAL_FORMAT,
'format' => $dateFormatIso,
'time' => true,
));
if ( Mage::registry('SomeRegistrySetinCurrentControllerAction') )
{
$form->setValues(Mage::registry('SomeRegistrySetinCurrentControllerAction')->getData());
}
return parent::_prepareForm();
}
It is rendering date, text fields in the form but not link.
'link'
to'text'
? Will the value show in the text box?form->addFieldset(
should be$form->addFieldset
, but I suspect that is just a typo here. So the only explanation, is to check your real code and make sure you don't have a typo somewhere. Like maybe, you have typedvaleu
instead ofvalue
.