validation-form-fields
TypeScript icon, indicating that this package has built-in type declarations

1.0.3 • Public • Published

Validation Form Fields

A lightweight, zero-dependency JavaScript/TypeScript library for validating form inputs with customisable rules. Supports length limits, alphanumeric enforcement, HTML blocking, and more.

Code Quality Publish to npm Version ESLint TypeScript

Table of Contents- Installation

Installation

To install the library, you can use npm or yarn:

npm install validation-form-fields

Usage

Basic examples:

import  { ValidationFormFields } from 'validation-form-fields';

  useEffect(() => {
    const input = document.getElementById('name') as HTMLInputElement;
    if (input){
      ValidationFormFields.attachValidation(input, {
        minLength: 3,
        maxLength: 255,
        allowAlphanumericOnly: true,
        blockHTML: true,
        requireNonEmpty: true,
      });
    }
  }, []);
import  { ValidationFormFields } from 'validation-form-fields';

const input = document.getElementById('name');
if (input){
    ValidationFormFields.attachValidation(input, {
    minLength: 3,
    maxLength: 255,
    allowAlphanumericOnly: true,
    blockHTML: true,
    requireNonEmpty: true,
    });
}

License

This project is licensed under the MIT License. See the LICENSE file for more details.

Package Sidebar

Install

npm i validation-form-fields

Weekly Downloads

6

Version

1.0.3

License

MIT

Unpacked Size

7.67 kB

Total Files

5

Last publish

Collaborators

  • beepboopbeep