0.0.3 • Published 3 years ago

@vetprovieh/formt-validation v0.0.3

Weekly downloads
-
License
Apache License 2....
Repository
github
Last release
3 years ago

Formt-Validation: A simple Validation-Component

This component helps to style a HTML-form with Bulma-CSS Stylesheets.

Usage

You have to call the Method validateForm() on class FormtValidation and hand over the Form-Element to validate. All input or Textareas which are invalid are marked.

Example:

let validator = new FormtValidation();
let form = document.querySelector("form");

let valid = validator.validateForm(form);

Extend

If you want to extend FormtValidation for another CSS-Framework you can use the Interface IDecorator. Here a simple example:

class MyDecorator implements IDecorator {
    success(element: HTMLInputElement) {
        // Style your Element
    }

    error(element: HTMLInputElement) {
        // Style your Element
    }
}

let decorator = new MyDecorator();
let validator = new FormtValidation(decorator);
let form = document.querySelector("form");

let valid = validator.validateForm(form);
0.0.3

3 years ago

0.0.2

3 years ago

0.0.1

3 years ago