How to properly handle page refresh?
The two scenarios you have explained are behaviours built into your browser. Most browsers will try to resubmit form data if you press F5 on a page where data has been submitted. This is to try to avoid data being lost by the average user.
It is as though you were to enter the site, complete the form and click Submit all over again.
To avoid handling this data again you could generate a random key and store it in a hidden form field. Then when the data is submitted, save this key in a session variable. If the data is resubmitted, you can put a check around your postback which compares the random key in the form data to that in the session. If they are the same then the data has already been handled.
I have a form on my page with many fields. I save field values in the datastore once user input a value (without waiting for form submission). Some score is calculated based on field values and displayed to the user. I also generate user's client id and store that in user's cookies for one hour.
I am not sure what should happen when user refreshed the page in browser:

if user pressed F5 in FF, then field values are still displayed in the browser;
when user pressed Ctrl+F5, then values are cleared.

In both cases I don't want to create new record for this user, so client id should remain the same. But in scenario (1) I should NOT clear field values in datastore and its score, but I should do it in scenario (2). How can I recognize that on the server side?