如何在管理表单中添加按钮?

Dis*_*ake 1 magento magento-1.9

我在管理表单中添加了一个按钮,如下所示。

$fieldset->addField('registered', 'button', array(
'label' => Mage::helper('core')->__('Send e-mail to all registered customers'),
'value' => Mage::helper('core')->__('Button Caption'),
'name'  => 'registered',
'onclick' => "setLocation('{$this->getUrl('*/*/registeremail')}')",
));
Run Code Online (Sandbox Code Playgroud)

该字段的功能正常工作,但按钮显示不正确。如下所示。

在此处输入图片说明

如何将此按钮显示为普通的magento按钮?

我尝试过

'after_element_html' => '<button type="button" onclick="setLocation('{$this->getUrl('*/*/registeremail')}')">All Registered</button>'

但是onclick调用是错误的。

Gul*_*rya 6

尝试

$fieldset->addField('registered', 'button', array(
            'label' => Mage::helper('core')->__('Send e-mail to all registered customers'),
            'value' => Mage::helper('core')->__('Button Caption'),
            'name'  => 'registered',
            'class' => 'form-button',
            'onclick' => "setLocation('{$this->getUrl('*/*/registeremail')}')",
        ));
Run Code Online (Sandbox Code Playgroud)

这对我有用。在此处输入图片说明