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

support for multiple error messages (which are defined in validators) #436

Open
wants to merge 1 commit 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/

restored main entry in bower json

added resolutions

added property errors for polylint

deleted unused hidden attribute

made errors array in paper input private
@tlouisse tlouisse force-pushed the feature/multipleValidators branch from 5a8b028 to 98993d5 Compare September 12, 2016 08:57
@vospascal
Copy link

vospascal commented Feb 22, 2017

something like this would be nice now there is no way to chain validator's
<paper-input-container>
<paper-input validator="validatorA validatorB"/>
<paper-input-error validator-name="validatorA">validatorA message</paper-input-error>
<paper-input-error validator-name="validatorB">validatorB message</paper-input-error>
</paper-input-container>

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

Successfully merging this pull request may close these issues.

3 participants