@vetprovieh/formt-validation
TypeScript icon, indicating that this package has built-in type declarations

0.0.3 • Public • Published

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);

Package Sidebar

Install

npm i @vetprovieh/formt-validation

Weekly Downloads

0

Version

0.0.3

License

Apache License 2.0

Unpacked Size

270 kB

Total Files

55

Last publish

Collaborators

  • vetprovieh