Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

html5-form-validator

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

html5-form-validator

The simplest HTML5 forms validator

  • 2.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
135
increased by46.74%
Maintainers
1
Weekly downloads
 
Created
Source

Travis CI Github Build Codacy Badge Codebeat Badge CodeFactor Badge DeepScan grade Analytics

HTML5 Form Validator

The simplest HTML5 forms validator.

This form validator uses the built-in capabilities of the browser to validate the required form fields.

All validation messages are shown as they are shown by the browser which means that they are internationalized and are NOT subject to change.

Visitor stats

GitHub stars GitHub forks GitHub watchers GitHub followers

Code stats

GitHub code size in bytes GitHub repo size GitHub language count GitHub top language GitHub last commit

Install

npm i html5-form-validator

or

yarn add html5-form-validator

Usage

import { HTML5FormValidation } from 'html5-form-validator';

Then initialize with default settings:

new HTML5FormValidation();

or supply your own

const form = document.querySelector('#form');

new HTML5FormValidation(form, {
	errorElement: 'form__error',
	invalidClass: 'is--invalid',
	submitHandler(instance) {
		console.log(instance);
	},
	validateOnInput: false
});

Options

OptionTypeRequiredDefaultDescription
errorElementstringfalse'error'The class name of the element that will be added to the DOM after the required field.
invalidClassstringfalse'invalid'The classname of the required field when it is invalid
submitHandlerFunctionfalsenullA function to run on form submission. Accepts a single argument - the HTML5FormValidation instance.
validateOnInputbooleanfalsetrueValidate as you type. Set to false to validate only on submit.

LICENSE

MIT


Connect with me:


Support and sponsor my work:

Keywords

FAQs

Package last updated on 07 Nov 2022

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc