I am getting a very critical problem in 'Submit' method, when I register a new user first time it save the user correct details. But then again I try to register one more user, its post the previous cached details in form data and I got the 'user already exists error message'.
Please give me any solutions to clear its cached data or refresh form data all times, when form is submitted.
My code is below:
registration.submit({
url: 'services/index.php/user/userRegister/',
method: 'POST',
success: function(result, response) {
if(response.msg == 'ALREADY_EXISTS') {
//if user with same email id already exists
Ext.Msg.alert('Validation Error', 'This user already exists');
} else if(response.msg == 'SUCCESS') {
//if new user register successfully, then make it loggedin
sessionStorage.setItem("email", response.email);
sessionStorage.setItem("display_name", response.display_name);
sessionStorage.setItem("firstname", response.firstname);
sessionStorage.setItem("lastname", response.lastname);
window.location = '#addgolfbag';
} else if(response.msg == 'ERROR') {
//if there is any server error while registration
Ext.Msg.alert('Error while registration');
}
},
failure: function(result, response) {
Ext.Msg.alert(response);
}
});
My problem is not with sessionstorage, I just want to know, is sessionstorage responsible for cached 'form data' sent by submit method all time untill, I don't make hard refresh (ctrl + f5) page.
In sessionstorage I am justing saving few details, but submit method post all fields with previous data (which sent on first time). So I think its 'Submit' method problem.
I am having the same problem with login form as well....
In fact I have tested with sessionStorage.removeItem as well, But still facing the same problem. Its submit the previous data...
Thanks for supporting me, but the actual problem is that 'getValues()' method returning the cached values.
Please consider these steps:
1. I did submit the login form with correct details, it moves to 'home' page with logged in. ---- correct
2. I did logout from there and it moves back to login form and destroy all sessions. ---- correct
3. But now even if I did not enter any details and press login button, its goes redirect. Because its getting the previous cached username and password. Its incorrect and that is my problem. ---- in correct