Magento 中的自定义表单 [英] Custom forms in Magento

查看:23
本文介绍了Magento 中的自定义表单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

任何人都可以提供有关如何在 Magento 中创建将数据发布到控制器操作的前端表单的虚拟指南代码片段.

我正在尝试编写与我们联系的变体.(我知道修改联系我们表格很容易,如此处所述).我还尝试创建一个包含其他字段的反馈表单.

给定这个基本形式:

<form action="<?php echo $this->getFormAction(); ?>"id="feedbackForm" method="post"><div class="input-box"><label for="name"><?php echo Mage::helper('contacts')->__('Name') ?><span class="required">*</span></label><br/><input name="name" id="name" title="<?php echo Mage::helper('contacts')->__('Name') ?>"value="<?php echo $this->htmlEscape($this->helper('contacts')->getUserName()) ?>"class="required-entry input-text" type="text"/>

<div class="button-set"><p class="required"><?php echo Mage::helper('contacts')->__('*必填字段') ?></p><button class="form-b​​utton" type="submit"><span><?php echo Mage::helper('contacts')->__('Submit') ?></跨度></button>

</表单>

将输入的名称输入到控制器操作进行处理需要采取哪些基本步骤?

解决方案

如果有人感兴趣,我通过构建自己的模块解决了这个问题,该模块很大程度上基于 Magento_Contacts 模块.

这里有一些帮助我解决问题的链接.

http://www.magentocommerce.com/wiki/custom_module_with_custom_database_table

http://inchoo.net/ecommerce/magento/magento-custom-电子邮件/

Can anyone provide a dummy guide code snippets on how to create a front end form in Magento that posts data to a controller action.

Im trying to write a variant of the contact us from. (I know its easy to modify the contact us form, as outlined here). I'm trying to also create a feedback form with additional fields.

Given this basic form:

<form action="<?php echo $this->getFormAction(); ?>" id="feedbackForm" method="post">   
                <div class="input-box">
                    <label for="name"><?php echo Mage::helper('contacts')->__('Name') ?> <span class="required">*</span></label><br />
                    <input name="name" id="name" title="<?php echo Mage::helper('contacts')->__('Name') ?>" value="<?php echo $this->htmlEscape($this->helper('contacts')->getUserName()) ?>" class="required-entry input-text" type="text" />
                </div>

    <div class="button-set">
        <p class="required"><?php echo Mage::helper('contacts')->__('* Required Fields') ?></p>
        <button class="form-button" type="submit"><span><?php echo Mage::helper('contacts')->__('Submit') ?></span></button>
    </div>
</form>

What are the basic step I need to take to get inputted name to a controller action for processing?

解决方案

If any one is interested, I solved this by building my own module which was heavily based on the Magento_Contacts module.

Here are some links that helped me figure things out.

http://www.magentocommerce.com/wiki/custom_module_with_custom_database_table

http://inchoo.net/ecommerce/magento/magento-custom-emails/

这篇关于Magento 中的自定义表单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
PHP最新文章
热门教程
热门工具
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆