sbkcnftwug
New Member
I am trying to validate my form and for some reason it always validates true even if I don't enter any value in the field for password fields. If I change my control to text the validation works if I don't enter anything in textbox. below is my code. I can't figure out what am I doing wrong here.Thanks\[code\]<form id="frmChangePassword" action="http://localhost/PatientAccount" method="post"> <div class="row"><input type="password" id="txtPWD" name="txtPWD" placeholder="" style="" class="text focus" value=""></div> <div class="row"><input type="password" id="txtReEnterPWD" name="txtReEnterPWD" placeholder="" style="" class="text" value=""></div> <div class="row"><input type="Button" ID="btnChangePassword" Name="btnChangePassword" STYLE="" Class="btn-submit" VALUE="http://stackoverflow.com/questions/14406384/Change Password" onClick="javascript:ValidateResetPassword();"></div></form><script> function ValidateResetPassword() { $("#frmChangePassword").validate( { rules: { "txtPWD": { required:true }, "txtReEnterPWD": { required:true } }, messages: { "txtPWD": { required: "Please enter Password" }, "txtReEnterPWD": {required: "Please re-enter password" } } }); if ($("#frmChangePassword").valid()) { hashPassword(); } }</script>\[/code\]