Form data "forgotten" on page refresh #16

Closed
hiltonian opened this Issue Aug 10, 2011 · 1 comment

Comments

Projects
None yet
2 participants

Usually when one refreshes a page with form data on it, Firefox remembers any data that has been entered. However, when tag-it is in use, all subsequent fields "forget" their previous state when refreshing the page.

For example. if I have a form with three input fields, "title", "tags" and "comments", and I enter some data into each field, then press refresh, Firefox will remember the title and tags that I have inserted, but not the comments.

I believe this is due to the fact that an additional input is added to the page for entering new tags, which must confuse the way Firefox remembers form data.

I think Firefox is the only browser that tries to remember form data when refreshing - but I could be wrong. I know this is a relatively trivial issue — I mean, if the other browsers forget form data, what does it matter if Firefox does likewise? — but if any radio buttons are used after the tag-it field, the wrong radio is checked when the page is reloaded, and if the user doesn't notice this they could submit incorrect data.

A rather un-elegant solution I have found for this is to insert <input type="text" style="display: none" class="tags-hidden-field" /> directly in the page's markup, then .remove() it using jQuery immediately after adding tag-it to the tags field. However, this doesn't really degrade gracefully. Is there another solution to this that I am overlooking?

Owner

aehlke commented Nov 25, 2012

I don't know what to do about this behavior, sorry.

I think a much better solution is to check if there's modified data in your form and warn the user if they try to refresh that they'll lose data. See e.g. http://stackoverflow.com/questions/3221161/how-to-pop-up-an-alert-box-when-the-browsers-refresh-button-is-clicked

@aehlke aehlke closed this Nov 25, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment