This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 15450 - needed method to set "current state" of a form as the "default state"
Summary: needed method to set "current state" of a form as the "default state"
Status: RESOLVED WONTFIX
Alias: None
Product: HTML WG
Classification: Unclassified
Component: HTML5 spec (show other bugs)
Version: unspecified
Hardware: PC Windows NT
: P2 enhancement
Target Milestone: ---
Assignee: This bug has no owner yet - up for the taking
QA Contact: HTML WG Bugzilla archive list
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-01-07 11:41 UTC by Giorgio
Modified: 2016-04-18 21:04 UTC (History)
10 users (show)

See Also:


Attachments

Description Giorgio 2012-01-07 11:41:50 UTC
my case is, briefly

<form>
    <input name="aaa" value="XXX">
    <input type="submit" value="Save">
    <input type="reset" value="Reset">
</form>

user changes value of "aaa" from XXX to YYY

in a "web 1.0" form the page will be reloaded and this is ok.

but in my case, this form will be sent by xhr,
then if "save" will be successful I have to loop manually over every data holder (texts, checkboxes, selects...) and set:

theinput.defaultValue = theinput.value;

otherwise the Reset button will reset the "aaa" value to "XXX",
thats not what I want, because I've saved the form.

so a form's interface method like

HTMLFormElement.setCurrentValuesAsDefaultValues();

would be really cool.

I hope this helps
Comment 1 Kornel Lesinski 2012-01-09 22:30:40 UTC
I'm curious what is your use case for including Reset button in the form? Is saving of entire form granular enough? 

If you're already using JavaScript to serialize the form, why not use that to restore previous values? Are there existing libraries (jQuery plugins, etc.) that solve this problem?
Comment 2 Ian 'Hixie' Hickson 2012-02-03 06:28:48 UTC
I've run into this too — in particular, Firefox seems very eager to fill in form fields and restore form control state even when they're not in <form>s, including button disabled states, etc, so that you can basically never guess when the page loads what state a form control is going to be in.

It's kinda annoying.

Not sure what to do about it.
Comment 3 contributor 2012-07-18 06:53:49 UTC
This bug was cloned to create bug 17813 as part of operation convergence.
Comment 4 Robin Berjon 2013-01-21 15:59:40 UTC
Mass move to "HTML WG"
Comment 5 Robin Berjon 2013-01-21 16:02:26 UTC
Mass move to "HTML WG"
Comment 6 Travis Leithead [MSFT] 2016-04-18 21:04:00 UTC
HTML5.1 Bugzilla Bug Triage: Incubation needed

This bug constitutes a request for a new feature of HTML. Our current guidelines, rather than track such requests as bugs or issues, is to create a proposal for the desired behavior, or at least a sketch of what is wanted (much of which is probably contained in this bug), and start the discussion/proposal in the WICG (https://www.w3.org/community/wicg/). As your idea gains interest and momentum, it may be brought back into HTML through the Intent to Migrate process (https://wicg.github.io/admin/intent-to-migrate.html).