Save the state of a form using localStorage