npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

iptools-jquery-validator

v2.0.1

Published

jQuery form validation plugin

Downloads

134

Readme

iptools-jquery-validator Build Status npm version Bower version

jQuery form validation plugin.

Requirements

  • jQuery >=1.11.3 <4.0.0

Supported validation schemas

| Schema | Description | | --------- | ----------- | | required | Checks if field has value. | | email | Checks if field value is email. | | regexp | Checks field value against regular expression defined in data-validation-regexp. | | phone | Checks if field value is phone number. Allows +, space and numbers. | | numeric | Checks if field value is numeric. Allows decimals, signs, and scientific notation. | | number | Checks if field value is number. | | name | Checks if field value is name, i.e. first or last name of person. | | street | Checks if field value is street name. | | housenumber | Checks if field value is house number. | | postcode | Checks if field value is post code. | | match | Checks if field value matches to field referenced by data-validation-connected-field. | | unique | Checks if field value is unique in amongst given references by data-validation-unique-with and data-validation-unique-set. |

Usage

iptools-jquery-validator relies on namespaced data attributes such as

| Attribute | Description | | --------- | ----------- | | data-validation | Comma-separated list of validation schemas to apply, e.g. data-validation="required,phone". See Supported validation schemas. |   | data-validation-trigger | Event on which validation should be triggered. Only events emitted from actual control are considered. | | data-validation-regexp | Regular expression definition for fields with regexp validation schema. | | data-validation-connected-field | Name of the connected field for fields with match validation schema. | | data-validation-unique-set | Namespace within which to perform unique validation. | | data-validation-unique-with | ID of field, value of which, in combination with current field's value, makes up unique value to be validated, e.g. forename + surname. | | data-validation-errormsg-<schema> | Error message to be displayed in case validation fails, e.g. data-validation-errormsg-required="Name is required.". See Supported validation schemas. |

Options

Following options (optional) can be used to initialise component:

| Option | Description | Default  | | ------ | ----------- | ------- | | stopOnRequired | Stop further validation if required validation schema fails | false | | validateOnSubmit | Trigger validation on submit | true | | validateOnCustomEvent | Trigger validation on custom event | null | | errorPublishingMode | Position of error message relative to erroneous field. Possible values: insertInto, insertAfter, insertBefore, appendToParent, prependToParent | appendToParent | | errorMsgBoxID | HTML Element ID holding error messages. Corresponds to errorPublishingMode: 'insertInto' | null | | errorClass | CSS class added to erroneous fields, error message and error class subscribers | error | | boxAnimationMode | Animation strategy applied to errors. Possible values: default, fade, slide | default (show/hide) | | animationDuration | Duration of boc animation in ms | 500 | | wipeTargets | Third party elements (e.g. errors) to be removed from DOM on validation | null |

Events

Following events are dispatched on element that component was initialised on:

| Event | Description | | --------- | ----------- | | success.iptValidator | Dispatched on validation success |   | failure.iptValidator | Dispatched on validation failure |  

Example

<form method="post" action="">
  <input type="text" data-validation="required,email" data-validation-trigger="change" data-validation-errormsg-required="Dieses Feld ist ein Pflichtfeld." data-validation-errormsg-email="Bitte geben Sie eine gültige E-Mail-Adresse an.">
</form>

<script src="src/iptools-jquery-validator.js"></script>
<script type="text/javascript">
  $(document).ready(function() {
    $('form').iptValidator({
      validateOnSubmit: true,
      stopOnRequired: false,
      errorPublishingMode: 'insertAfter',
      errorMsgBoxID: null,
      errorClass: 'error'
    });
  });
</script>

Contributions

See CONTRIBUTING.md.

Licence

Copyright © 2016, 2017 Interactive Pioneers GmbH. Licenced under GPL-3.