Security News
pnpm 10.0.0 Blocks Lifecycle Scripts by Default
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
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 689 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
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
Product
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.
Research
Security News
Socket researchers have discovered multiple malicious npm packages targeting Solana private keys, abusing Gmail to exfiltrate the data and drain Solana wallets.