Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Custom forms in Magento

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?

like image 755
Dan Avatar asked Jun 30 '09 21:06

Dan


People also ask

What are custom forms?

Custom Forms allow you to add custom fields, drop down menus, and check boxes to work item forms. These additional fields create a section on the work item to track specific details for your organization. Once a custom form is created, it can then be assigned to one or more Work Types.


1 Answers

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/

like image 166
Dan Avatar answered Oct 05 '22 03:10

Dan