1.0.2 • Published 2 months ago

fluttering-frost-forms v1.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
2 months ago

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.

1.0.2

2 months ago

1.0.1

3 months ago

1.0.0

3 months ago