There are many ways to do this. One of them is to override submit
method of VarienForm
class:
VarienForm.prototype.submit = VarienForm.prototype.submit.wrap(function($super, url) {
// your action here
// ..
// then call parent method
$super(url);
return false;
}
Something like this may help you
$base_fieldset->addField(
'your_btn', 'button', array(
'name' => 'your_btn',
'label' => Mage::helper('testmodule')->__(
'Click on folowing link to test popup Dialog:'
),
'value' => $this->helper('testmodule')->__('Test popup dialog >>'),
'class' => 'form-button',
'onclick' => 'javascript:openMyPopup()'
)
);
$form->setUseContainer(true);
$this->setForm($form);
parent::_prepareForm();
Then in layout file
<?php echo $this->getFormInitScripts() ?>
<script type="text/javascript">
function openMyPopup() {
var url = '<?php echo $this->getUrl('adminhtml/dashboard/index') ?>?';
if ($('browser_window') && typeof(Windows) != 'undefined') {
Windows.focus('browser_window');
return;
}
var dialogWindow = Dialog.info(null, {
closable:true,
resizable:false,
draggable:true,
className:'magento',
windowClassName:'popup-window',
title:'Test popup Dialog',
top:50,
width:300,
height:150,
zIndex:1000,
recenterAuto:false,
hideEffect:Element.hide,
showEffect:Element.show,
id:'browser_window',
url:url,
onClose:function (param, el) {
alert('onClose');
}
});
}
function closePopup() {
Windows.close('browser_window');
}
</script>
Best Answer
You can show the imagen when the form is submitted: