I need the correct URL for my form action! 
In app/design/adminhtml/default/default/template/customertab/action.phtml
This is file code, Is there any things I'm missing?
<form action="<?php echo Mage::helper("adminhtml")->getUrl("adminhtml/customertab_customertab/reset"); ?>" method="post">
 <input name="form_key" type="hidden" value="<?php echo Mage::getSingleton('core/session')->getFormKey() ?>" /> 
 <input type="submit" value="Post This Form" />
</form>
In app/code/local/Sean/CustomerTab/etc/config.xml I have:
<config>
 <modules>
 <Sean_CustomerTab>
 <version>0.0.1</version>
 </Sean_CustomerTab>
 </modules>
 <adminhtml>
 <layout>
 <updates>
 <customertab>
 <file>customertab.xml</file>
 </customertab>
 </updates>
 </layout>
 </adminhtml>
 <admin>
 <routers>
 <adminhtml>
 <args>
 <modules>
 <customertab before="Mage_Adminhtml">Sean_CustomerTab_Adminhtml</sean_customertab>
 </modules>
 </args>
 </adminhtml>
 </routers>
 </admin>
 <global>
 <blocks>
 <customertab>
 <class>Sean_CustomerTab_Block</class>
 </customertab>
 </blocks>
 </global>
</config>
In app/code/local/Sean/CustomerTab/controllers/Adminhtml/CustomerTab/CustomerTabController.php:
<?php
class Sean_CustomerTab_Adminhtml_CustomerTab_CustomerTabController extends Mage_Adminhtml_Controller_Action
{
 function resetAction()
 {
 die("Sean was here controller");
 }
}
When I click the form submit button it takes me to mywebsite.com/index.php/power/customertab_customertab/reset/
and it's a 404 Not Found
3 Answers 3
Assuming your <frontName> is customertab
<form action="<?php echo Mage::helper("adminhtml")->getUrl("customertab/customertab/reset"); ?>" method="post">
Dont forget to add form key
 <input type="hidden" name="form_key" value="<?php echo Mage::getSingleton('core/session')->getFormKey(); ?>" />
 - 
 added this but still not getting to the controllerCodingMageSheen– CodingMageSheen2016年11月22日 19:45:57 +00:00Commented Nov 22, 2016 at 19:45
 - 
 I got it working, and I needed this for it to work as well!CodingMageSheen– CodingMageSheen2016年11月22日 22:48:22 +00:00Commented Nov 22, 2016 at 22:48
 
Change your config.xml code
 <admin>
 <routers>
 <adminhtml>
 <args>
 <modules>
 <customertab before="Mage_Adminhtml">Sean_CustomerTab_Adminhtml</customertab>
 </modules>
 </args>
 </adminhtml>
 </routers>
 </admin>
Your controller file path also need to change:
Before:
app/code/local/Sean/CustomerTab/controllers/Adminhtml/CustomerTabController.php
After:
app/code/local/Sean/CustomerTab/controllers/Adminhtml/CustomerTab/CustomerTabController.php
Change your controller class:
before:
Sean_CustomerTab_Adminhtml_CustomerTabController
After
Sean_CustomerTab_Adminhtml_CustomerTab_CustomerTabController
Your url is: adminhtml/customertab_customertab/reset
- 
 I did this exactly and still not workingCodingMageSheen– CodingMageSheen2016年11月22日 19:30:27 +00:00Commented Nov 22, 2016 at 19:30
 - 
 i'll update my code in the questionCodingMageSheen– CodingMageSheen2016年11月22日 19:41:45 +00:00Commented Nov 22, 2016 at 19:41
 
In the class Sean_CustomerTab_Adminhtml_CustomerTab_CustomerTabController
Because CustomerTabController has 2 words and both are capitalized.
The form action had to be:
<form action="<?php echo Mage::helper("adminhtml")->getUrl("adminhtml/customertab_customerTab/reset"); ?>" method="post">
In Magento the first letter from the controller doesn't matter if it's capitalized or not but any letter after the first matters or it won't work! Just an annoying tip for anyone not getting their controller to work sigh. But thanks for your answers everyone! Also shoutout to Prashant Valanda for telling me to input the form key that was required as well!
Explore related questions
See similar questions with these tags.