Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

JavaScript Forum


You are currently viewing our JavaScript Forum as a guest. Please register to participate.
Login



Reply
Function not checking all conditions.....pls help.
Old 01-18-2010, 02:46 AM Function not checking all conditions.....pls help.
Isabella_Smith's Avatar
Ultra Talker

Posts: 285
Trades: 0
Hi forum,

I am running a function for change password.........this function isn't checking any of the condition given below..........please let me know where I mistook.

HTML Code:
function valid_password(frm)
{
    var err;
    if(frm.old.value=="")
    {
        err = "Please enter old password.";
        alert(err);
        frm.old.focus();
        return false;
    }
    else if(checkforpassword(frm.old.value))
    {
        err = "Invalid characters in old password.";
        alert(err);
        frm.old.focus();
        return false;
    }
    if(frm.newpass.value=="")
    {
        err = "Please enter new password.";
        alert(err);
        frm.newpass.focus();
        return false;
    }
    else if(checkforpassword(frm.newpass.value))
    {
        err = "Invalid characters in new password.";
        alert(err);
        frm.newpass.focus();
        return false;
    }
    else
    {
        if(frm.confirmpass.value=="")
        {
            err = "Please confirm password.";
            alert(err);
            frm.confirmpass.focus();
            return false;
        }
        else if(frm.confirmpass.value!=frm.newpass.value)
        {
            err = "Confirm password mismatch.";
            alert(err);
            frm.confirmpass.focus();
            return false;
        }
    }
    return true;
}
Elaborating my query............I am calling this to my other page like this.

Quote:
<form id="frm" name="frm" method="post" action="controller/changepass_controller.php" onSubmit="javascript: return valid_password(this);">
<table width="530" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="left" valign="top">
<div align="center" class="style1">
<?php
if($_SESSION["msg"]!="")
{
echo $_SESSION["msg"];
$_SESSION["msg"]="";
}
?>
</div><br>
<table width="500" border="0" cellspacing="5" cellpadding="2">
<tr>
<td align="left" valign="middle" class="normltext">Old Password:<span class="style1">*</span> </td>
<td align="center" valign="middle" class="normltext">&nbsp;</td>
<td width="288" class="textblackblod"><label>
<input name="old" type="password" class="manditoryfield" id="old" style=" width:170px; height:22px;">
</label></td>
</tr>
<tr>
<td align="left" valign="middle" class="normltext">New Password:<span class="style1">*</span> </td>
<td align="center" valign="middle" class="normltext">&nbsp;</td>
<td class="textblackblod"><input name="newpass" type="password" class="manditoryfield" id="newpass" style=" width:170px; height:22px;"></td>
</tr>
<tr>
<td align="left" valign="top" class="normltext">Confirm Password:<span class="style1">*</span> </td>
<td align="center" valign="top" class="normltext">&nbsp;</td>
<td class="textblackblod"><input name="confirmpass" type="password" class="manditoryfield" id="confirmpass" style=" width:170px; height:22px;"></td>
</tr>

<tr>
<td align="right" valign="middle" class="normltext">&nbsp;</td>
<td align="left" valign="middle" class="normltext">&nbsp;</td>
<td align="left" valign="top" class="textblackblod"><table width="185" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="92" align="left" valign="top"><table width="64" border="0" align="left" cellpadding="0" cellspacing="0">
<tr>
<td width="6"><img src="img/btm-lt.jpg" width="7" height="28" alt="" /></td>
<td width="52" align="center" valign="middle"><input name="Submit" type="submit" class="btm" value="Submit" /></td>
<td width="6" align="left"><img src="img/btm-rt.jpg" width="7" height="28" alt="" /></td>
</tr>
</table></td>
<td width="93"><table width="64" border="0" align="left" cellpadding="0" cellspacing="0">
<tr>
<td width="6"><img src="img/btm-lt.jpg" width="7" height="28" alt="" /></td>
<td width="52" align="center" valign="middle"><input name="Submit2" type="reset" class="btm" value="Reset" /></td>
<td width="6" align="left"><img src="img/btm-rt.jpg" width="7" height="28" alt="" /></td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
</table>
<input type="hidden" name="work" value="changepassword"/>
</form>

I've checked it trice but unable to find the problem............its not checking any field from java script.

But its working when I paste it within the page......ur help would be appreciated.
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE



Please login or register to view this content. Registration is FREE
buy all indian salwar Kameez, Sarees and clothes

Last edited by Isabella_Smith; 01-19-2010 at 02:40 AM..
Isabella_Smith is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 01-20-2010, 04:45 PM Re: Function not checking all conditions.....pls help.
logic ali's Avatar
Super Talker

Posts: 104
Trades: 0
Quote:
Originally Posted by Isabella_Smith View Post
But its working when I paste it within the page......ur help would be appreciated.
Then there must be something wrong with the way you're including the .js file, but you haven't shown that.
logic ali is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Function not checking all conditions.....pls help.
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.11313 seconds with 12 queries