JS with back button, client side validation