Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

form.reset() does not completely reset some paper form elements #27

Closed
hawkett opened this issue Jul 14, 2015 · 10 comments
Closed

form.reset() does not completely reset some paper form elements #27

hawkett opened this issue Jul 14, 2015 · 10 comments

Comments

@hawkett
Copy link

hawkett commented Jul 14, 2015

Example below shows the paper-input label continues to behave as though it has content.

screen shot 2015-07-13 at 8 34 47 pm

Do form elements need additional notification on reset(), or do they need to handle the existing behaviour differently?

@kishaningithub
Copy link

Im also facing this issue!. Its interesting to note that its been 3 months since this issue was posted. Still no response :-(

@notwaldorf
Copy link
Contributor

I'm sorry, I haven't gotten around to looking at it. There were a billion other higher priority issues that got in the way. I'll try to take a look this week

@hawkett
Copy link
Author

hawkett commented Oct 15, 2015

Thanks @notwaldorf - much appreciated! You guys are doing an amazing amount of stuff for such a small team.

@notwaldorf notwaldorf self-assigned this Oct 19, 2015
@notwaldorf
Copy link
Contributor

@hawkett Thanks for the kind words. They're very appreciated 💖

@sjmoreno
Copy link

@notwaldorf Thanks a lot for this fix! Trying to reset a form using paper-input and this works great when all the element values have changed but it is not triggering the notify to the parent when el.value === this._customElementsInitialValues[i]. Doing some local testing seems like something like what I have below (not optimized, just nulling out as a proof of concept) does the trick:

   for (var el, i = 0; el = this._customElements[i], i < this._customElements.length; i++) {
      if (el.disabled)
        continue;
      if (this._usesCheckedInsteadOfValue(el)) {
        el.checked = this._customElementsInitialValues[i];
      } else {
        if(el.value === this._customElementsInitialValues[i]) {
          //Need to force a change on value to trigger the notify to `paper input`
          //or somehow fire some notification.
          el.value = null;
        }
        el.value = this._customElementsInitialValues[i];
      }
    }

Is opening a new issue best way to address this? Can also submit a pull request.

@Typel
Copy link

Typel commented Dec 4, 2015

I am experiencing this issue while attempting to reset a gold-email-input that is enclosed within an iron-form. It appears to be running one last auto-validation after the form is reset, causing it to turn red as if there was an error.

Is .reset() supposed to clear auto-validation states as well?

@notwaldorf
Copy link
Contributor

Re-opening, since paper-inputs still don't see like they reset too well: http://jsbin.com/joweso/edit?html,output

@dman777
Copy link

dman777 commented May 17, 2017

I noticed that after form reset, the paper-radio buttons and paper-dropdown-menu breaks...the new form does not display default selections for these elements. Using "1.1.4" version.

@xelra
Copy link

xelra commented Dec 27, 2017

I'm seeing this issue in Polymer 2 with paper-input. When the form resets, it clears all the values, but the label stays afloat.

@PPCM
Copy link

PPCM commented Jan 16, 2018

I have the same issue in Polymer 2, it reset correctly paper-input elements with name parameter set.
I have a confirm password without a name, and it doesn't reset it value

Then, I have other named elements like paper-dropdown-menu containing a paper-listbox which is not reseted

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants