Situation: A user submits a form. After submitting the input are tested. If the input is lacking something, I want a 'back' button that scrolls or jumps to part that is not correctly filled. Going back with javascript is trivial, but then to scroll/jump to the anchor ...
I tried
<BUTTON onClick='window.history.go(-1);location.hash = \"#anchor\" ;'>
The page should not reload to not change the user input that is already entered.
The problem is that I first have to use window.history.back to go back to the page before submitting the form. But I have to do process the user input on the form to know what is missing. Then, after processing, I know exactly where to go, but it is the page before. I cannot use a href=gotopage.php#anchor because this reloads the page and deletes all the info the user entered in the form. history.back preserves the user input but start at the bottom of the page (firefox). I don't want - if possible - use javascript to test the user input.