Open Bug 1419517 Opened 8 years ago Updated 3 years ago

Form input restoration after refresh breaks dynamic forms

Categories

(Core :: Layout: Form Controls, defect, P3)

57 Branch
defect

Tracking

()

UNCONFIRMED

People

(Reporter: naddiseo, Unassigned)

Details

User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:57.0) Gecko/20100101 Firefox/57.0 Build ID: 20171112125346 Steps to reproduce: Firefox restores the values of inputs after a refresh, which can help usability in some contexts, however, it ignores the values which are hardcoded into the HTML and can cause sites to fail. Use-case: I have a form which is generated on the server, but on client side can have inputs dynamically added to it via javascript. To keep track of the dynamic inputs, there's an input field which tracks the count of inputs so that the server can find the new submitted fields. After a refresh, the javascript expects the form to be in a pristine state, but with the input restoration, it's not. (This is the form style used with formsets from django: https://docs.djangoproject.com/en/1.11/topics/forms/formsets/#understanding-the-managementform .) Example use-case: https://jsfiddle.net/8m0jd9gq/ 1. open console to watch output. Value should start = 1 2. add a few rows, value should be increasing which each row 3. in the output pane only, reload the frame with right click -> This frame -> Reload Frame. (and allow the resend) 4. After the reload the initial value of the hidden input is the value that it was before the reload. 5. Try to add another row. -> an error occurs In chrome, all the values are reset. Actual results: The value for the hidden inputs are restored to what they were pre-refresh, but the dynamically generated inputs were discarded leaving the form in an inconsistent state Expected results: Either all the inputs are remember (including the dynamically generated ones), or firefox shouldn't override values of inputs that are specified in the HTML.
Component: Untriaged → Layout: Form Controls
Product: Firefox → Core
Priority: -- → P3
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.