doukong1391 2010-11-18 10:23
浏览 67
已采纳

Magento表单未在自定义模块中发布

I created a new module and a new top level menu item in the Admin section. I also created a few views in the templates/[mymodule] folder, with forms I want to use in my app. The purpose of the module is to contain all the custom functionality for my client's store, firstly a small form to edit product recurring-delivery subscriptions on-the-fly.

I successfully created a non-EAV data model from a multi-table join, and populated the default view (called in index/index and loaded through the menu item) with the records. Next step, to install the "search by email address" form.

My form consists of

<form id="search_form" name="search_form" method="post" action="<?php echo $this->getUrl('editsubs/index/post') ?>">
Search by Email: < input type="text" name="emailsearch" id="emailsearch" />< /form> < button onclick="searchForm.submit()" class="scalable save" type="button">
<script type="text/javascript">
    var searchForm = new varienForm('search_form');
</script>

and I have verified the URL is properly formed and it is trying to post; however the URL editsubs/index/post is not found and Magento redirects to the dashboard.

Could missing items in config.xml cause this behavior or is there some other reason this might be occuring? Something I'm overlooking?

Magento version CE 1.4.1.1. I'm purposely keeping this very bare-bones and NOT building it on top of SaRP or using their forms.

Routers section of config is:

<admin>
        <routers>
            <Editsubscr2>
                <use>admin</use>
                <args>
                    <module>Kindbars_Editsubscr2< /module>
                    <frontName>editsubs</ frontName>
                </args>
            </Editsubscr2>
        </routers>
    </admin>

Thanks in advance!!

Kris

  • 写回答

3条回答 默认 最新

  • dttphb59319 2010-11-18 13:15
    关注

    When the admin section redirects back to the dashboard, it is often because there was an exception or an error while loading the page.

    Try enabling logging and checking your logs to see if you had an exception. If that doesn't work, Alan Storm has a plugin to view routes that you may want to try.

    As a slightly murkier possible cause, do you have safe URLs turned on right now? If your admin URLs have long alphanumeric tokens specified, you do. Your form may need to specify a token in order for Magento to allow access to that URL.

    Hope that helps!

    Thanks, Joe


    UPDATE:

    For the "secret key", it looks like URLs should be run through Mage_Adminhtml_Model_Url::getUrl. This function contains a method getSecretKey that seems to append a key based on whether the keys are enabled. Also take a look at Mage_Core_Model_Session::getFormKey, which is referenced by adminhtml/url. This should give you more insight into how those URLs are generated.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥15 phython如何实现以下功能?查找同一用户名的消费金额合并—
  • ¥15 孟德尔随机化怎样画共定位分析图
  • ¥18 模拟电路问题解答有偿速度
  • ¥15 CST仿真别人的模型结果仿真结果S参数完全不对
  • ¥15 误删注册表文件致win10无法开启
  • ¥15 请问在阿里云服务器中怎么利用数据库制作网站
  • ¥60 ESP32怎么烧录自启动程序
  • ¥50 html2canvas超出滚动条不显示
  • ¥15 java业务性能问题求解(sql,业务设计相关)
  • ¥15 52810 尾椎c三个a 写蓝牙地址