vaadin / proposal-for-vaadin-form

Small and fast framework-agnostic library for creating forms with Web Components
Apache License 2.0
9 stars 0 forks source link

Form validation: a `validator()` function #11

Open vlukashov opened 5 years ago

vlukashov commented 5 years ago

form-validation

const form = new VaadinForm();
// init the form

const passwordRepeatedCorrectly = values => {
  if (values.password !== values.passwordRepeated) {
    return `Please check that you've repeated the password correctly.`;
  }
};

form.validator = [passwordRepeatedCorrectly];