Hi,

I created custom login form with help of article and it is working fine when we submit with correct credentials. But it is not displaying validation error messages when condition is failed. I am searching from last 4 hours but i did not get any results.I am posting my code below.

<?php global $user; 
global $base_url;

?>
<?php if ($user->uid) : ?>
<span class="login_text">Welcome, </span> <?php print ($user->name); ?> <br>
<?php print l("Your Account",'user/'.$user->uid); ?> |
<?php print l("Log-Out","logout", array(), drupal_get_destination()); ?>
<?php else : ?>
<span class="login_text"><b>Login:</b> </span>
<form action="<?php echo $base_url; ?>/user" method="post">
<div><div class="form-item"><?php print $messages; ?> 
<label for="edit-name"><span class="login_text">Username:</span><span class="form-required" title="This field is required.">*</span>
<input type="text" maxlength="60" name="edit[name]" id="edit-name"  size="10" value="" tabindex="1" class="form-text required" /></label>
<label for="edit-pass"><span class="login_text">Password:</span><span class="form-required" title="This field is required.">*</span>
<input type="password" maxlength="" name="edit[pass]" id="edit-pass"  size="10"  tabindex="2" class="form-text required" /></label>
<input type="hidden" name="edit[form_id]" id="edit-form_id" value="user_login"  />


<input type="submit" name="op" value="Log in"  tabindex="3" class="form-submit" /></form>
<?php endif; ?> 

Any Ideas?
Thank you in Advance.

Comments

faruq1256’s picture

At last i get the Solution. i am posting the code which is working fine for me.In that code i just changed input field's name and id like

<strong>
<input maxlength="30" name="name" id="edit-name" size="30" value="" tabindex="1" class="form-text required" type="text">
<input name="pass" id="edit-pass" maxlength="128" size="30" tabindex="2" class="form-text required" type="password">
<input name="form_id" id="edit-user-login" value="user_login" type="hidden">
</strong>

.


<?php global $user; ?>
<?php if ($user->uid) : ?>
<span class="login_text">Welcome, </span> <b><?php print ($user->name); ?> </b> <br>
<?php print l("Your Account",'user/'.$user->uid); ?> |
<?php print l("Log-Out","logout"); ?>
<?php else : ?> <?php if ($messages): print $messages; endif; ?>
<form action="/drupal/user" accept-charset="UTF-8" method="post" id="user-login">
<div>

 <label for="edit-name">Username: <span class="form-required" title="This field is required.">*</span></label>
 <input maxlength="30" name="name" id="edit-name" size="30" value="" tabindex="1" class="form-text required" type="text">
 </div>
<div class="form-item" id="edit-pass-wrapper">
 <label for="edit-pass">Password: <span class="form-required" title="This field is required.">*</span></label>
 <input name="pass" id="edit-pass" maxlength="128" size="30" tabindex="2" class="form-text required" type="password">


<input name="form_id" id="edit-user-login" value="user_login" type="hidden">
<input name="op" id="edit-submit" value="Log in" tabindex="3" class="form-submit" type="submit">

</div></form>


<?php endif; ?>
Pomliane’s picture

Status: Active » Closed (won't fix)

This version of Usernode is not supported anymore. The issue is closed for this reason.
Please upgrade to a supported version and feel free to reopen the issue on the new version if applicable.

This issue has been automagically closed by a script.