@ageesea/micro-form
v1.0.9
Published
A micro helper for html forms
Downloads
25
Readme
Micro helper for HTML Forms
A collection of helper methods for manipulating html form through JS.
Install
In your terminal, run
npm install @ageesea/micro-form
Usage
Method: getFormValues(formSelector, isExcludeEmpty=false)
A method that scans your html form inputs to create an object structure. It uses the name attribute as key and their value as value. It also support array-based names.
<!-- example.html -->
<form id="form-employee">
<input name="full_name" />
<input name="age" />
<input name="accounts[]" />
<input name="accounts[]" />
</form>
// example.js
import {getFormValues} from '@ageesea/micro-form'
const values = getFormValues('#form-employee')
Output:
{
full_name: "Juan dela cruz",
age: 23,
accounts: [
"value1", "value2"
]
}