1

I have registration form, suppose there are 5 fields, and all are required i.e. mandatory. My problem is that when user login & fill 2 fields of that registration form & click browser back button, then I want to restrict user to same form & Show requiredField Validator messages of incomplete fields. So How can I fire Validation on browser back button & restrict user on same form.

3 Answers 3

3

You cannot affect browser behavior when the user clicks the Back button.

Sign up to request clarification or add additional context in comments.

1 Comment

My client want to fill all entries by user & then submit data. So he want to disable back button. He is forcing user to fill all details. & lOGIN means it is special ID given by Client company to customer, So there is no database issue.
1

The correct solution is to check right after user have been login, if he has complete the registration entries on database, and if not you redirect him to fill that data.

From your comments, to alert them a solution is to capture the onbeforeunload and check there if they have fill out everything or not, show your message.

Simple example, you just need here to place your conditions.

window.onbeforeunload = function() {
    return 'You have unsaved changes!';
}

8 Comments

No its not like that, My clien want to fill all entries by user & then submit data. So he want to disable back button.
@ConstantLearner tell him that this is impossible - you can not disable the back button. Try to understand what I have write.
Client is forcing user to fill all details. & LOGIN means it is special ID given by Client company to customer, So there is no database issue.
@ConstantLearner And where do you save all that entries ?
I have seperate table of REGISTRATION. Will you pls tell me that is there any solution to restrict user to same page & force him to fill all entries & If he click back button then alert him with error i.e. incomplete messages
|
1

You can't disable the back button (see the other answers and their comments).

What you can do is check on every page whether the user is logged in. If not, redirect him to your login page. This way the user can't access the site without logging in, which I guess is what your client is really after.

2 Comments

@ Hans Kesting: No dear, he just want to force users to complete registration !!!!!
@ConstantLearner - logging in, completing registration: you can use the same methods.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.