New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

data-validator

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

data-validator

A module for defining all of your form validation logic as data attributes.

latest
Source
npmnpm
Version
1.2.1
Version published
Maintainers
1
Created
Source

data-validator

A module for defining all of your form validation logic as data attributes.

Why?

If anything is going to change on the fly it is your form validation requirements. This module prevents you from having to dig into your JS files. It also makes it easy to have localized error messaging.

Example

<form class="form">

  <input type="text" name="name"
    data-validate
    data-validate-required="true"
    data-validate-required-msg="Please enter your name." />
    
  <input type="text" name="email"
    data-validate
    data-validate-required="true"
    data-validate-required-msg="Please enter your email."
    data-validate-format="^([\w_\.\-\+])+\@([\w\-]+\.)+([\w]{2,10})+$"
    data-validate-format-msg="Please enter a valid email address." />
    
</form>
CommonJS (Will also work with AMD and traditional globals)
var validator = require('data-validator');

var errors = validator.validate({
  form: '.form',
  dump: '.errorList'
});

if (errors.length < 1) {
  // Carry on...
}

Requires jQuery

Keywords

validation

FAQs

Package last updated on 22 Aug 2015

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