tree: e588980a7310a2d1595a5491ebeb7a196d9efb68 [path history] [tgz]
  1. .github/
  2. demo/
  3. test/
  4. .bower.json
  5. .gitignore
  6. .travis.yml
  7. bower.json
  8. CONTRIBUTING.md
  9. index.html
  10. iron-validatable-behavior.html
  11. README.md
polymer_1.8.1/bower_components/iron-validatable-behavior/README.md

Build status

Demo and API docs

##Polymer.IronValidatableBehavior

Use Polymer.IronValidatableBehavior to implement an element that validates user input. Use the related Polymer.IronValidatorBehavior to add custom validation logic to an iron-input.

By default, an <iron-form> element validates its fields when the user presses the submit button. To validate a form imperatively, call the form's validate() method, which in turn will call validate() on all its children. By using Polymer.IronValidatableBehavior, your custom element will get a public validate(), which will return the validity of the element, and a corresponding invalid attribute, which can be used for styling.

To implement the custom validation logic of your element, you must override the protected _getValidity() method of this behaviour, rather than validate(). See this for an example.

Accessibility

Changing the invalid property, either manually or by calling validate() will update the aria-invalid attribute.