I need to add a button in my custom module admin form , which calls an action 'upload'
How can I achieve it ?
Best Answer
When defining a form element you have the option of specifying after_element_html. what you put there will be shown after the element itself. Here is an example:
I found the solution.
To add a country multi select dropdown in your form you need to add below code in your Block/Adminhtml/ModuleName/Edit/Tab/Form.php file.
You have to add the fields in _prepareForm() in \NameSpace\ModuleName\Block\Adminhtml\ModuleName\Edit\Tab\Form.php add the below code.
$fieldset->addField('<Data base Field name>', 'image', array(
'label' => Mage::helper('<Module Name>')->__('Logo'),
'name' => '<your Data base Field name>',
'note' => '(*.jpg, *.png, *.gif)'
));
Best Answer
When defining a form element you have the option of specifying
after_element_html
. what you put there will be shown after the element itself. Here is an example:I think you can start from here. you can use the
onclick
on the button to do an ajax call (or something like that) and upload your image.