PolymerElements / paper-dropdown-menu

A Material Design browser select element
https://www.webcomponents.org/element/PolymerElements/paper-dropdown-menu
61 stars 107 forks source link

Validation doesn't work for "required" fields #222

Open icewhite opened 7 years ago

icewhite commented 7 years ago

Description

Documentation refers to the "required" and "error-message" fields, but when they're set the error message is not displayed (It is added to page but the paper-input-error field is set to "visibility: hidden;"

I fixed this by adding mapping of the auto-validate & required fields on the paper-input component of paper-dropdown-menu.html. Snippet below. With this change applied the component works as I'd expect.

        <paper-input
          type="text"
          invalid="[[invalid]]"
          readonly
          disabled="[[disabled]]"
          value="[[selectedItemLabel]]"
          placeholder="[[placeholder]]"
          error-message="[[errorMessage]]"
          auto-validate$="[[autoValidate]]" <!--Added
          required$="[[required]]" <--Added
          always-float-label="[[alwaysFloatLabel]]"
          no-label-float="[[noLabelFloat]]"
          label="[[label]]">

Expected outcome

Error message is displayed when required is set and error-message is defined.

Actual outcome

Error message is not displayed

Live Demo

Steps to reproduce

Browsers Affected