I attempted to implement a asp:CustomValidator along with client-side JavaScript in order to validate that the user does not input the same new password as the old password using the following code...
<script type="text/javascript">
function CustomValidator1_ServerValidate1(source, arguments) {
var sOldPassword = document.form1.<%= tbOldPassword.ClientID %>.value;
var sNewPassword = document.form1.<%= tbNewPassword.ClientID %>.value;
if (sOldPassword == sNewPassword) {
arguments.IsValid = false;
} else {
arguments.IsValid = true;
}
}
</script>
<asp:CustomValidator ID="CustomValidator1" runat="server"
ErrorMessage="Old and new password cannot be the same"
ClientValidationFunction="CustomValidator1_ClientValidate1"
ValidateEmptyText="True" ValidationGroup="Custom"></asp:CustomValidator>
Unfortunately, this implementation is not functioning correctly. Can anyone identify why it is not working?