fluttering-frost-forms

1.0.2 • Public • Published

Fluttering Frost Forms

A lightweight JavaScript library for creating and managing forms with ease.

Installation

Install fluttering-frost-forms using npm:

npm install fluttering-frost-forms

Usage

First, import FlutteringFrostForms into your project:

import FlutteringFrostForms from 'fluttering-frost-forms';

Define a schema for your form:

const formSchema = {
username: {
defaultValue: '',
validator: (value) => value.length > 0 && value.length < 20
},
birthday: {
defaultValue: '',
validator: (value) => moment(value, 'YYYY-MM-DD').isValid()
}
};

Initialize your form with the schema:

const myForm = new FlutteringFrostForms(formSchema);
myForm.initializeForm();

Validate and submit the form:

try {
myForm.validateField('username', 'johnDoe');
myForm.validateField('birthday', '1990-01-01');
myForm.submitForm();
} catch (error) {
console.error(error.message);
}

License

This project is licensed under the MIT License.

Package Sidebar

Install

npm i fluttering-frost-forms

Weekly Downloads

5

Version

1.0.2

License

MIT

Unpacked Size

3.71 kB

Total Files

5

Last publish

Collaborators

  • achinmijael