How to add a new custom login block in left/right side in magento

If you want to add login page in a statick block and want to place that in left side or right side then use the following code to make your login block and place it anywhere it will work.

<?php $custmlogin= new Mage_Customer_Block_Form_Login();?>
<form action="<?php echo $custmlogin->getPostActionUrl() ?>" method="post" id="login-form">
<ul class="topLogin">
<label for="email" class="required"><?php echo $this->__('Email Address') ?><em>*</em></label>
<input type="text" name="login[username]" value="<?php echo $this->htmlEscape($this->getUsername()) ?>" id="email" class="input-text required-entry validate-email" title="<?php echo $this->__('Email Address') ?>" />
<label for="pass" class="required"><?php echo $this->__('Password') ?><em>*</em></label>
<input type="password" name="login[password]" class="input-text required-entry validate-password" id="pass" title="<?php echo $this->__('Password') ?>" />
<li class="logInButton">
<button type="submit" class="button" title="<?php echo $this->__('Login') ?>" name="send" id="send2"><span><?php echo $this->__('Login') ?></span></button>


  1. Hi, can you tell me why the validation is not working on this form?

    1. write below java script to validate that block.
      <script type="text/javascript">
      var dataForm = new VarienForm('login-form', true);
      where login-form is the ID of the form

  2. Hello Friends,

    This code is really working. But I have one query. When I put this code at sidebar-left, it will run properly. But when I put this code in popup window this for is not working at all. Can u please give me any solution for this.

    Thanking you.