Reputation: 11
I have a Rails app that lets users create tutorials and quizzes. There are many users taking the quizzes and many quizzes in a tutorial. My client wants the quiz results to persist when a student navigates away from the quiz. So the use case would be:
Now this would be pretty easy to do if I enforced a "Save" submit so that the answers could be stored in a session or whatever, but the client (and I agree) thinks people will not remember to save before navigating away.
Looking for advice on how to approach this. I'm thinking an observer and cookies.
Upvotes: 0
Views: 178
Reputation: 15492
There can be two ways to handle this.
<script language='javascript' type='text/javascript'> window.onbeforeunload = function (evt) { return "This is a demonstration that you are leaving me"; } </script>
Upvotes: 0