cancel
Showing results for 
Search instead for 
Did you mean: 

How can I set default value in text box in magento admin custom form

How can I set default value in text box in magento admin custom form

I have create a field English video and save to data in database but I can't set value in edit time

I have used this code for set value.

$fieldset->addField('title', 'text', array(
            'label'     => Mage::helper('ultimate_option')->__('English Video'),
            'id'  => 'option_english',
            'name'      => 'option_english',
            'after_element_html' => '<table id="modulename_tbl_data_English" cellspacing="0">
                                <button id="English" class="add" type="button" title="Add"><span><span><span>Add</span></span></span></button>
                                </table>',
            'value'  => 'hello !!'         
        )); 

 

but getting this blank result

 

 

 

How can I set value for English text box at edit time.

 

1 REPLY 1

Re: How can I set default value in text box in magento admin custom form

Not sure what you are trying to achieve. Is this a field in product editing page? You used that value attribute correct, but the field will be filled with the value of product automatically, so its likely that this product has an empty english video value already, to avoid it, you can

unset($values['english_video');

after

 

 

$values = Mage::registry('product')->getData();

in Mage_Adminhtml_Block_Catalog_Product_Edit_Tab_Attributes::_prepareForm.