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

required elements aren't actually required #98

Open
d4l3k opened this issue Nov 15, 2017 · 1 comment
Open

required elements aren't actually required #98

d4l3k opened this issue Nov 15, 2017 · 1 comment

Comments

@d4l3k
Copy link

d4l3k commented Nov 15, 2017

If you specify required on a paper-autocomplete element it's not actually required. It only requires something to be filled out in the paper-input element, but nothing actually has to be selected.

In this example something has been entered and the paper-input element required property is satisfied, but nothing has actually been selected.
2017-11-14-171647_703x98_scrot

$0.value
undefined
$0.validate()
true
@d4l3k
Copy link
Author

d4l3k commented Nov 15, 2017

As a hack, I have a wrapper element around it with the following code

    <paper-autocomplete
           id="input"
           required
           error-message="Required"
           ...
           value="{{value}}">
    </paper-autocomplete>
  validate () {
    const valid = this.$.input.validate() && this.value && this.value.length > 0
    if (!valid) {
      this.$.input.root.querySelector("paper-input").invalid = true
    }
    return valid
  }

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

No branches or pull requests

1 participant