A lightweight JavaScript library for creating and managing forms with ease.
Install fluttering-frost-forms
using npm:
npm install fluttering-frost-forms
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);
}
This project is licensed under the MIT License.