Live data from Hacker News

Dear Internet: Take the reset buttons off your damn forms

f00li5h.pin21.com

11–20 of 78 posts

Re: Dear Internet: Take the reset buttons off your damn forms

#11
post #6

They still exist and I've pressed them just before thumping the desk. Is there a greasemonkey script to get the browser to ignore them; are there extensions for any browser to do this without greasemonkey? or with a user stylesheet? input[.reset]{display:none;} what is the right css? I haven't used it in a while?

The following should work in browsers with decent CSS2 support [1]:

    input[type=reset] { display: none; }
You might need a !important in there immediately before the semicolon if your user stylesheets aren't getting priority otherwise.

[1] http://www.w3.org/TR/CSS2/selector.html#attribute-selectors

Re: Dear Internet: Take the reset buttons off your damn forms

#14
post #6

They still exist and I've pressed them just before thumping the desk. Is there a greasemonkey script to get the browser to ignore them; are there extensions for any browser to do this without greasemonkey? or with a user stylesheet? input[.reset]{display:none;} what is the right css? I haven't used it in a while?

input[type="reset"] { display: none }

Should do it on most browsers.

Re: Dear Internet: Take the reset buttons off your damn forms

#16

Good example of implementing a feature because it's easy to do, rather than because it has real utility. Why it's part of the HTML form spec I don't know. Was it ever useful?

The actual button isn’t particularly useful but the DOM interface is. Firefox (and other browsers?) cache DOM entries in certain situations. This is useful if you refresh the page accidentally with a half completed comment in a text box, but less useful if you’re building a complicated webapp that assumes an initial state. A simple document.forms[0].reset() at the top of your code works wonders.

Re: Dear Internet: Take the reset buttons off your damn forms

#17
post #9

I have a form that can be populated with records from a grid. "reset" allows the user to clear the selected record and input new data.

Wouldn't that better be served by a "new" button?

From user acceptance testing we done, that gives the impression it would create a new record from the populated data.

Edit: we use the wording "Clear" not "Reset" btw.

Re: Dear Internet: Take the reset buttons off your damn forms

#20
Even better, get rid of your forms entirely, especially long forms with all kind of questions that you really don't need the answer to. Or have fields that are ambigious and improperly validated. Or multipage forms that have no way of going back without losing your filled in data.
Post reply on HN