diff --git a/paper-dropdown-menu.html b/paper-dropdown-menu.html index 06f4ab8..cb2931a 100644 --- a/paper-dropdown-menu.html +++ b/paper-dropdown-menu.html @@ -57,6 +57,11 @@ Applications can listen for the `iron-select` and `iron-deselect` events to react when options are selected and deselected. +### Validation + +If the `auto-validate` attribute is set, the element will be validated when +the selected item changes. + ### Styling The following custom properties and mixins are also available for styling: @@ -135,6 +140,14 @@ ], properties: { + + /** + * Set to true to auto-validate the input value when it changes. + */ + autoValidate: { + type: Boolean + }, + /** * The derived "label" of the currently selected item. This value * is the `label` property on the selected item if set, or else the @@ -365,6 +378,16 @@ this._setValue(value); this._setSelectedItemLabel(value); + + if( this.autoValidate ){ + var valid; + if (this.validate) { + valid = this.validate(); + } else { + valid = this.checkValidity(); + } + this.invalid = !valid; + } }, /**