Skip to content
This repository has been archived by the owner on May 15, 2023. It is now read-only.

Feature/multiple validators #24

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

tlouisse
Copy link

@tlouisse tlouisse commented Sep 8, 2016

Currently, it's not possible to use multiple validators on an input.

Also see:

With this pull request, it will become possible to add multiple validators to elements implementing the validatable behavior, without having to write a new custom validator that combines functionality of other validators.

Along with this functionality, the following will be supported:

  • custom messages:
    • stored in validators (so there's a single source of truth, resulting in consistency between forms and less development work)
    • support for multiple error messages, ordered by priority (the most important message will be shown by the paper-input)
  • support for native validators('required', 'max', 'min', 'step', 'maxlength', 'minlength', 'pattern', 'emailtype'(type=email) and 'urltype' (type=url))
  • automatic instantiating of custom validators
  • possibility to connect unique instances of a validator to a validatable-element (when overriding of the default message will be needed)

Everything is tested for backwards compatibility. All tests have run in chrome 51, firefox 46, OS X 10.9 safari 7, OS X 10.10 safari 8, OS X 10.11 safari 9, Windows 7 IE 10, Windows 8.1 IE 11, Windows 10 microsoftedge, Android 4.3, Android 4.4, Android 5, Android 6, iOS 7, iOS 8, iOS 9.3.

Note that, since the validation functionality is located in different repositories, the above functionality will contain pull requests in the following repositories:

The link below shows an example of what would be the benefit of the old vs. the new situation.
It makes clear what the API will look like and how little code will be needed to achieve the same in the new situation.

https://tlouisse.github.io/iron-validatable-behavior/components/iron-validatable-behavior/demo/

@cleverplatypus
Copy link

@tlouisse Is this pull request still work in progress? This change would make quite a difference.

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

Successfully merging this pull request may close these issues.

3 participants