Security News
Node.js EOL Versions CVE Dubbed the "Worst CVE of the Year" by Security Experts
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
Smart form helper. It's framework agnostic.
npm install formkit
There is example of common usage without any frameworks.
import formkit from 'formkit';
const validate = (errors, values) => {
if (!values.firstname) errors.firstname = 'Required';
};
// get new form instance
const form = formkit.newForm();
// initialize form fields
form.init([
'firstname',
], validate);
const submitHandler = (values) => console.log('The form has submittes with', values);
form.onSubmit(submitHandler);
// change field's value
form.fields.firstname.handleChange('my new name');
console.log(form.fields.firstname.dirty) // false - field is different with previously saved state
console.log(form.fields.firstname.touched) // true - field was dirty at least once since form has initialized.
console.log(form.fields.firstname.valid) // true
console.log(form.fields.firstname.invalidMsg) // '' - message which sets in validate function
// emit submit event - "submitHandler" will be called
form.handleSubmit();
To use in your favorite framework you have to call field's handleChange
method
after each field changes. And call fom.handleSubmit()
submit on form submit if submitting is using.
In other hand you can add handler on form saving form.onSave(callback)
to save form's state after field change.
npm test
FAQs
FormKit command line interface.
The npm package formkit receives a total of 806 weekly downloads. As such, formkit popularity was classified as not popular.
We found that formkit demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.