google / google/material-design-lite

Form reset should reset text fields to initial state

Open
#4,444 1 comment 0 reactions 0 assignees View on GitHub
Textfield
Dominant language
HTML
Stars
32.2k
Forks
4.9k
PR merge metrics
No merged PRs in 30d

Description

Calling [.reset()](https://developer.mozilla.org/en-US/docs/Web/API/HTMLFormElement/reset) on a form element, or using a reset button should reset text fields to initial state.

[Codepen](http://codepen.io/Halvardos/pen/QEKVJg)

At the moment the text field remains dirty (and invalid even if not required) after a reset requiring the developer to add a call to `MaterialTextfield.checkDirty();` but this does not remove invalid state, so we have to manually call `MaterialTextfield.change();` to both remove dirty and invalid state.

I see there are some issues that have been opened earlier about this but they have been closed without solving this issue. IMO this is not working as one would expect and should be remedied.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.