简体   繁体   中英

Fatal error: Call to a member function getEmail() on a non-object in magento

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...

In this case getFormData() just returns the Model or Helper which owns the function getEmail()

So just create a Block class with the function getFormData() and create a Helper class which owns the getEmail() function.

HTH

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM