form input state (including disabled state and other properties) are cached across reloads and history navigation
Categories
(Core :: DOM: Forms, defect, P3)
Tracking
()
People
(Reporter: aardmaat, Unassigned)
References
(Blocks 2 open bugs, )
Details
(Keywords: testcase)
Attachments
(3 files)
475 bytes,
text/html
|
Details | |
399 bytes,
text/html
|
Details | |
2.41 KB,
patch
|
Details | Diff | Splinter Review |
Updated•14 years ago
|
Comment 2•14 years ago
|
||
Updated•14 years ago
|
![]() |
||
Comment 4•14 years ago
|
||
![]() |
||
Comment 6•14 years ago
|
||
Comment 11•13 years ago
|
||
Comment 12•13 years ago
|
||
Comment 13•13 years ago
|
||
![]() |
||
Comment 14•13 years ago
|
||
Comment 15•13 years ago
|
||
Comment 16•13 years ago
|
||
![]() |
||
Comment 17•13 years ago
|
||
Comment 18•13 years ago
|
||
![]() |
||
Comment 19•13 years ago
|
||
![]() |
||
Comment 20•13 years ago
|
||
Comment 21•13 years ago
|
||
![]() |
||
Comment 22•13 years ago
|
||
Comment 23•13 years ago
|
||
Comment 24•13 years ago
|
||
Comment 25•13 years ago
|
||
Comment 26•13 years ago
|
||
Comment 28•11 years ago
|
||
Comment 29•11 years ago
|
||
Comment 30•10 years ago
|
||
Comment 31•10 years ago
|
||
Updated•10 years ago
|
Comment 32•9 years ago
|
||
Comment 33•9 years ago
|
||
Comment 34•9 years ago
|
||
Comment 37•8 years ago
|
||
Comment 38•8 years ago
|
||
Comment 39•8 years ago
|
||
Comment 40•8 years ago
|
||
![]() |
||
Comment 41•8 years ago
|
||
Comment 42•8 years ago
|
||
Comment 43•7 years ago
|
||
Comment 44•7 years ago
|
||
Updated•7 years ago
|
Comment 46•7 years ago
|
||
Comment 47•6 years ago
|
||
I notice strange behavior of disabled
in FF 66.0.2.
If the button becomes enabled, its state is saved after refresh.
Disabled state of button resets.
Updated•6 years ago
|
Comment 48•6 years ago
|
||
See bug 1547409. Moving webcompat whiteboard tags to project flags.
Updated•6 years ago
|
Updated•6 years ago
|
Updated•6 years ago
|
Updated•4 years ago
|
Comment 52•3 years ago
•
|
||
Wow, 11 years old. Just been bitten by this from a bug report from our users.
The auto-restoration of form fields basically BREAKS AJAX form submission flow - on reload the old form values will be restored. This can cause duplicate page submissions from users.
Generally any time you prevent the form from being submitted, Firefox will keep the old form values and restore on reload. There's nothing you can do about that, except add autocomplete=off
to your form fields which sucks because it fixes this problem and breaks another useful feature.
Firefox is the odd one out here. Chrome doesn't auto restore, nor does Safari. Why is Firefox having such an opinionated way of handling this that isn't even mentioned anywhere in the spec?
Would be great to have more eyes on this.
===
Example code:
<form method="POST">
<textarea name="test"></textarea>
<button name="submit" value="submit" type="submit">
Submit
</button>
</form>
<script>
document.querySelector('form').addEventListener('submit', function(e) {
e.preventDefault(); // Firefox doesn't care. It will still persist the form values.
// Handling the form by ajax. Firefox doesn't see this and will still keep old form data on reload.
fetch(e.target.action, { method: e.target.method, body: new FormData(e.target) });
});
</script>
Updated•3 years ago
|
Comment 54•3 years ago
|
||
Anne, is any of this specced these days? Clearly, 10 years ago it wasn't... (cf comment 6)
Any alignment with other browsers probably needs some kind of spec. Also, my understanding is that chromium recently started adding a feature similar to bfcache, which I imagine will be related (but I'm not sure how they treat form fields in those circumstances).
Comment 55•3 years ago
•
|
||
There is nothing concrete, but your ping (and that of holegary) was rather timely. https://github.com/whatwg/html/issues/6853 has discussion about this behavior and Chrome is also making changes in this area. I asked Chrome if they looked at disabled state and whether there should be an event for web developers.
Edit: discussion moved to https://github.com/whatwg/html/issues/7292.
Updated•3 years ago
|
Updated•2 years ago
|
Updated•2 years ago
|
Comment 57•2 years ago
|
||
Any workaround for this bug without JS?
Comment 58•2 years ago
|
||
autocomplete="off"
?
Comment 59•2 years ago
|
||
(In reply to Emilio Cobos Álvarez (:emilio) from comment #58)
autocomplete="off"
?
It is forbidden by validator.w3.org for radiobuttons. I use radiobuttons to switch tabs. radiobuttons have no <form/> parent thus I cannot set it on it.
Comment 60•2 years ago
|
||
I found workaround for tabs made on radiobuttons.
<input type="radio" name="tab-$rnd" id="tab1" checked="checked"/>
<input type="radio" name="tab-$rnd" id="tab2"/>
The $rnd is random number or epoch in milliseconds. The state of tabs is no longer remembered after refresh.
It is sad, we report the bugs and no one does remove them for 12 years. This error does not appear to be in a blocking state.
Updated•11 months ago
|
Updated•10 months ago
|
Comment 68•10 months ago
|
||
We can't really track this as a WebCompat issue as I can't find active real-world breakage. The URL reported in this bug is no longer active, and I couldn't find a real site in the dependencies. I'll keep the WebCompat Priority flag unset because of that.
However, this is probably still worth fixing, as this has the potential of breaking sites in really hard-to-understand ways. :/
Comment 69•3 months ago
|
||
The URLs cited in comment 16 are still active, one showing an example of the problem, the other a developer workaround. As of today, 8 Dec 2024, Safari, Opera, and Chrome do NOT exhibit the problem, so Firefox is still an outlier. I keep the pages active specifically to provide a test case for this behavior.
Description
•