i am using jquery validate and i have a login form that validate
the validation code show below
$("form#loginForm").validate({
submitHandler: function(form){
//code here
},
rules: {
user_login: { required: true },
user_password: { required: true}
开发者_如何学JAVA },
messages: { }
});
The validation works fine
MY PROBLEM is that if i type the password first and then type the username and submit the form the password field is reset and ask me to type a password.
If type username first and then password all works fine.
Does anyone have an idea.
Thanks in advance
This is the browser 'feature'. Some browser like firefox can save the form's username and password. When you left username blank, type the password first, then type the username, Firefox will try to search it's own database for the matched password for that username. If there is no data for it, the password will automatically cleared from any of your previous type. If it found a data, your type will be replaced with the saved data.
This feature is useful for saving the password in the website that you always visiting, but will become annoying when you developing your own web application. Your case is common in all 'modern' browser, not just Firefox.
精彩评论