Magento – Custom login form won’t show any error message

magento-1.9

I am using custom login form in my magento site. I below mention my custom code

    <?php echo $this->getChildHtml('customer.form.login.extra')?>
            <div class="market_place_login_ctrl">
                <form action="<?php echo Mage::getBaseUrl();?>customer/account/loginPost/" method="post" id="login-form" class="market_place_login_ctrl">
                            <?php echo $this->getBlockHtml('formkey'); ?>
                             <div class="col-md-5">
                                <div class="row">
                                    <input type="text" name="login[username]" placeholder="Your Email ID (username)" value="<?php echo $this->escapeHtml($this->getUsername()) ?>" id="email" class="input-text required-entry validate-email" title="<?php echo $this->__('Email Address') ?>" />
                                </div>
                            </div>
                            <div class="col-md-5">
                                <div class="row">
                                    <input type="password" name="login[password]" placeholder="Password" class="input-text required-entry validate-password" id="pass" title="<?php echo $this->__('Password') ?>" />
                                </div>
                            </div>
                            <div class=" col-md-2">
                                <div class="row">
                                <button type="submit" class="button" title="<?php echo $this->__('Login') ?>" name="send" id="send2"><span ><span><?php echo $this->__('Login') ?></span></span></button>
                                </div>
                           </div>
                           <a href="<?php echo Mage::getUrl('customer/account/forgotpassword') ?>">Forgot password?</a>

                             <?php echo $this->getChildHtml('form.additional.info'); ?>
                </form>     
            </div>   



    <script type="text/javascript">
    //<![CDATA[
        var dataForm = new VarienForm('login-form', true);
    //]]>
    </script>

But my problem is if customer successfully logged in it redirect to customer account else wrong username or wrong password it won't display any error message. it just reload the page. How i fix it?

Best Answer

You are not echoing message block in your custom login phtml file. So put the message block inside login phtml will resolve this issue.

Put this code just above the form declaration

  <?php echo $this->getMessagesBlock()->toHtml() ?>
  <form>
      ....
  </form>
Related Topic