Skip to content

shrimstrel/fluttering-frost-forms

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

A lightweight library for creating and managing forms in JavaScript.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published