Note that there are some explanatory texts on larger screens.

plurals
  1. POMagento: Admin form action not correct
    text
    copied!<p>I want to add a new form to the edit customer page, so far so good, using rewrites to customer_edit_tabs i was able to add a tab and my admin form to the page. Code looks like this.</p> <pre><code>protected function _beforeToHtml() { $this-&gt;addTab('extraoptions', array( 'label' =&gt; Mage::helper('customer')-&gt;__('Extra options'), 'class' =&gt; 'ajax', 'url' =&gt; $this-&gt;getUrl('module/adminhtml_tabs/info', array('_current' =&gt; true)), )); </code></pre> <p>This adds my tab corrently. From there the link on the tabs controller:</p> <pre><code> public function infoAction() { $this-&gt;_init(); $this-&gt;getResponse()-&gt;setBody( $this-&gt;getLayout()-&gt;createBlock('module/adminhtml_tabs_edit')-&gt;toHtml() );; } </code></pre> <p>This links to my form container on Block/Adminhtml/Tabs/Edit.php</p> <pre><code>class Namespace_Module_Block_Adminhtml_Tabs_Edit extends Mage_Adminhtml_Block_Widget_Form_Container{public function __construct() { parent::__construct(); $this-&gt;_objectId = 'id'; $this-&gt;_mode = 'edit'; $this-&gt;_blockGroup = 'module'; $this-&gt;_controller = 'adminhtml_tabs'; $this-&gt;_updateButton('save', 'label', Mage::helper('module')-&gt;__('Save')); } public function getHeaderText() { return Mage::helper('module')-&gt;__('Extra Options'); } </code></pre> <p>} </p> <p>My Block/Adminhtml/Tabs/Edit/Form.php</p> <pre><code>class Namespace_Module_Block_Adminhtml_Tabs_Edit_Form extends Mage_Adminhtml_Block_Widget_Form { public function __construct() { parent::__construct(); } protected function _prepareForm() { $form = new Varien_Data_Form(array( 'id' =&gt; 'info_form', 'action' =&gt; $this-&gt;getUrl('module/adminhtml_tabs/save', array('id' =&gt; $this-&gt;getRequest()-&gt;getParam('id'))), 'method' =&gt; 'post', 'enctype' =&gt; 'multipart/form-data' ) ); $fieldset = $form-&gt;addFieldset('extra_options', array('legend' =&gt; Mage::helper('module')-&gt;__('Extra Options Fieldset'))); $fieldset2-&gt;addField('extra', 'text', array( 'name' =&gt; 'zip', 'title' =&gt; Mage::helper('module')-&gt;__('extra'), 'label' =&gt; Mage::helper('module')-&gt;__('extra data'), 'maxlength' =&gt; '250', 'required' =&gt; false, )); $form-&gt;setUseContainer(true); } protected function _prepareLayout() { return parent::_prepareLayout(); } </code></pre> <p>Everything is fine, I have a new button below the default save customer buttons, but this save button does not update the action, so if i click it, it goes to the default customer/edit/save action, it does not tell me the method does not exist which it should. My guess is that there is something wrong with the container but i have tried three tutorials with little differences to no avail, hope someone can help and even maybe someone will find my code helpful.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload