Skip to content

Commit 419518e

Browse files
woutersamaeykiatng
andauthored
New event "init_form_values_after" after data set on a form (#1485)
* New event "init_form_values_after" after data set on a form Magento does not have a common event after data is set on a form. This new event allows us to change the form, the elements and the values once data is entered, giving full flexibility. I needed this event in a special case where I needed to change the options of a select, to include the current value that was not in the existing options list. There was no other way to do this without overriding many forms 1 by 1. * Update app/code/core/Mage/Adminhtml/Block/Widget/Form.php Co-authored-by: Ng Kiat Siong <kiatsiong.ng@gmail.com> Co-authored-by: Ng Kiat Siong <kiatsiong.ng@gmail.com>
1 parent cfc98cf commit 419518e

File tree

1 file changed

+7
-0
lines changed
  • app/code/core/Mage/Adminhtml/Block/Widget

1 file changed

+7
-0
lines changed

app/code/core/Mage/Adminhtml/Block/Widget/Form.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,13 @@ protected function _beforeToHtml()
143143
{
144144
$this->_prepareForm();
145145
$this->_initFormValues();
146+
Mage::dispatchEvent(
147+
'adminhtml_block_widget_form_init_form_values_after',
148+
[
149+
'block' => $this,
150+
'form' => $this->getForm()
151+
]
152+
);
146153
return parent::_beforeToHtml();
147154
}
148155

0 commit comments

Comments
 (0)