Magento 1.8 – How to Create Custom Form in Custom Module with Form Helper

magento-1.8

I need to create vendor registration from for our vendor. How to create Form helper in custom form

<form action="<?php echo $this->getPostActionUrl() ?>" method="post" id="form-validate">
<ul>
<li class="fields">

                </li>
                <li>
                    <label for="email_address" class="required"><em>*</em><?php echo $this->__('Email Address') ?></label>
                    <div class="input-box">
                        <input type="text" name="email" id="email_address" value="<?php echo $this->escapeHtml($this->getFormData()->getEmail()) ?>" title="<?php echo $this->__('Email Address') ?>" class="input-text validate-email required-entry" />
                    </div>
                </li>
</ul>
</form>

I m getting error Fatal error: Call to a member function getEmail() on a non-object
I need to know how can i crete form object in magento…

Best Answer

The problem in your case is, that the function $this->getFormData() does not return an object to work with where you can get the e-mail from. Does your block class derive from Mage_Customer_Block_Form_Register?

Have a look at getFormData in app/code/core/Mage/Customer/Block/Form/Register.php to see how this is done there.