Password Validation....
-
Hi, I have a form Changepassword.aspx. In that i have password field.I want that password field should accept at least 1 numeric 1 alphanumeric and it should be minimum 7 characters long and maximum 20 characters. how can i do that using java script or in c#. Please provide any helpful link related to this or provide me some code to achieve this task. regards,
Pranav Dave
-
Hi, I have a form Changepassword.aspx. In that i have password field.I want that password field should accept at least 1 numeric 1 alphanumeric and it should be minimum 7 characters long and maximum 20 characters. how can i do that using java script or in c#. Please provide any helpful link related to this or provide me some code to achieve this task. regards,
Pranav Dave
-
Hi, I have a form Changepassword.aspx. In that i have password field.I want that password field should accept at least 1 numeric 1 alphanumeric and it should be minimum 7 characters long and maximum 20 characters. how can i do that using java script or in c#. Please provide any helpful link related to this or provide me some code to achieve this task. regards,
Pranav Dave
As per the first answer, or you could use a regular expression to validate the input. Has the advantage of only the expression needing to change if you decide to change your validation.
-
Hi, I have a form Changepassword.aspx. In that i have password field.I want that password field should accept at least 1 numeric 1 alphanumeric and it should be minimum 7 characters long and maximum 20 characters. how can i do that using java script or in c#. Please provide any helpful link related to this or provide me some code to achieve this task. regards,
Pranav Dave
Here you go. I used this script on one of my sites-
function validatePassword(fld) {
var error ="";
var pwdFilter = /^\w*(?=\w*\d)(?=\w*[a-z])(?=\w*[A-Z])\w*$/ ;if (fld.value.length < 7 || fld.value.length > 20) {
error += "-Password must be 7-20 characters\n";
}
if (!pwdFilter.test(tfld)) {
error += "-Password must contain at least 1 number, lowercase, and uppercase\n";
}if (error != "") {
alert("Some fields need correction:\n" + error);
return false;
}
return true;
}That is the Javascript validation. You can call it onSubmit of a form-
<form method=POST action=register.aspx name=demo onSubmit='return validateForm(this)'>
Try that out. Good luck! Ranjit Viswakumar Professional Services Specialist HostMySite.com[^]
-
Here you go. I used this script on one of my sites-
function validatePassword(fld) {
var error ="";
var pwdFilter = /^\w*(?=\w*\d)(?=\w*[a-z])(?=\w*[A-Z])\w*$/ ;if (fld.value.length < 7 || fld.value.length > 20) {
error += "-Password must be 7-20 characters\n";
}
if (!pwdFilter.test(tfld)) {
error += "-Password must contain at least 1 number, lowercase, and uppercase\n";
}if (error != "") {
alert("Some fields need correction:\n" + error);
return false;
}
return true;
}That is the Javascript validation. You can call it onSubmit of a form-
<form method=POST action=register.aspx name=demo onSubmit='return validateForm(this)'>
Try that out. Good luck! Ranjit Viswakumar Professional Services Specialist HostMySite.com[^]
-
Hi, I have a form Changepassword.aspx. In that i have password field.I want that password field should accept at least 1 numeric 1 alphanumeric and it should be minimum 7 characters long and maximum 20 characters. how can i do that using java script or in c#. Please provide any helpful link related to this or provide me some code to achieve this task. regards,
Pranav Dave