
Security News
CVE Volume Surges Past 48,000 in 2025 as WordPress Plugin Ecosystem Drives Growth
CVE disclosures hit a record 48,185 in 2025, driven largely by vulnerabilities in third-party WordPress plugins.
Form validation helper
form = new ldForm(config);
ldForm automatically scan every input fields by \*[name] selector, so you must provide name attributes for each input or .form-control element:
<input type="text" name="username"/>
<textarea class="form-control" name="description"/>
Or, you can specify your own getFields function to apply your own rules.
Additionally, if you have an element with its type being 'submit', ldForm will automatically remove it's 'disabled' class when validation passed. You can overwrite this behavior by manually specify a submit element with submit option.
For nested form, simply add a ldform attribute as scoping element to separate them:
<div ldform>
<input name="a">
<div ldform>
<!-- b is scoped and won't be handled, unless we have another ldForm over #form2 -->
<input name="b">
</form>
</form>
root: base element for this form. HTMLElement or CSS Selector. Required.
init(): init function.
verify(name, value, element): validation function.
getFields(root): customized rules for getting fields.
input: root - root element for ldForm
return: fields object ( see below )
if omitted, default to use selector \*[name]
names(status, fields): return list of name for fields to check. if omitted, default to all fields.
afterCheck(status, fields): custom function for doing anything after check
debounce(n, s): should check call debounce?
values: hash object with default values for corresponding keys.
submit: specify the element to be un-disabled when form is validated.
initCheck: force a checkAll at initialization.
An object with each key corresponding to a field and value of that key corresponding to field status. For example:
{
"name": 0,
"password": 2,
"recaptcha": 3,
"newsletter": 1
}
The values have following meaning:
An object containing fields elements, such as:
{
"name": ...,
"password": ...,
"recaptcha": ...,
"newsletter": ...
}
ready - return true if form is valid and ready to engage.
check({n, now}) - check fields for all touched fields. if n is provided, touch the field named n. if now = true, check immediately without debouncing. to check multiple fields, provide a list:
check([{...}, {...}, ... ])
values
on(event-name, cb) - listen to event "event-name" by callback cb. current supported event:
reset - clear form fields and reset status ( clear is-invalid / is-valid classes )
field(n) - get input field with name 'n'
checkAll() - force check all fields immediately. useful in programmatically input fields.
getfd - get FormData object corresponding to all fields in this form.
MIT License
FAQs
form validation tool
The npm package ldform receives a total of 29 weekly downloads. As such, ldform popularity was classified as not popular.
We found that ldform demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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
CVE disclosures hit a record 48,185 in 2025, driven largely by vulnerabilities in third-party WordPress plugins.

Security News
Socket CEO Feross Aboukhadijeh joins Insecure Agents to discuss CVE remediation and why supply chain attacks require a different security approach.

Security News
Tailwind Labs laid off 75% of its engineering team after revenue dropped 80%, as LLMs redirect traffic away from documentation where developers discover paid products.