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

live-form-validation-es6

v1.9.4

Published

Nice client-side live form validation for Nette Forms 2.4. Script by default works nicely with Twitter Bootstrap 3.

Downloads

110

Readme

Live Form Validation ES6

This is modified version of Live Form Validation for usage in ES6 syntax as module.

:no_entry: Nice client-side live form validation for Nette Forms 2.4.


Build Status Licence Downloads total Latest stable

Discussion / Help

Join the chat

Install

NPM

npm install --save live-form-validation

Manually

All you need is to link live-form-validation.js file from to your HTML document. That's it!

The script already contains the netteForms.js file, so don't use it again and remove it from your HTML document.

Rawgit

  • Dev: https://rawgit.com/contributte/live-form-validation/master/live-form-validation.js
  • Stable: https://cdn.rawgit.com/contributte/live-form-validation/v1.8.1/live-form-validation.js

Versions

| State | Version | Branch | |-------------|-----------|----------| | development | ^1.9.4 | master | | stable | ^1.8.1 | master |

Usage

Script by default works nicely with Twitter Bootstrap 3, but you can customize the options to fit your exact needs.

ES6 usage

Script can be used in standard way described bellow or as ES6 module.

First you need to import module and link it to the window context like this:

import LiveFormValidation from 'live-form-validation-es6';

window.LiveForm = LiveFormValidation.LiveForm;
window.Nette = LiveFormValidation.Nette;

or

const liveFormValidation = require('live-form-validation-es6');

window.LiveForm = liveFormValidation.LiveForm;
window.Nette = liveFormValidation.Nette;

Then you need to run initialization of validation when DOM is ready. For example:

document.addEventListener('DOMContentLoaded', () => {
   window.Nette.init(); 
});

or with jQuery

$(() => {
   window.Nette.init();  
});

Options

You can change default options by calling LiveForm.setOptions({ ... }); after including the script. Give only options that you want to change. For example:

<script src="/js/live-form-validation.js"></script> 
<script>
	LiveForm.setOptions({
		messageErrorPrefix: 'Error: ',
		wait: 500
	});
</script> 

Alternatively, if you want to set options before the script is loaded, create LiveFormOptions = { ... }; with options that you want to change. For example:

<script>
	LiveFormOptions = {
		messageErrorPrefix: 'Error: ',
		wait: 500
	};
</script> 
<script src="/js/live-form-validation.js"></script> 

Available options

Option | Description ------ | ----------- showMessageClassOnParent | CSS class of control's parent where error/valid class should be added; or "false" to use control directly messageParentClass | CSS class of control's parent where error/valid message should be added (fallback to direct parent if not found); or "false" to use control's direct parent controlErrorClass | CSS class for an invalid control controlValidClass | CSS class for a valid control messageErrorClass | CSS class for an error message enableHiddenMessageClass | control with this CSS class will show error/valid message even when control itself is hidden (useful for controls which are hidden and wrapped into special component) disableLiveValidationClass | control with this CSS class will have disabled live validation disableShowValidClass | control with this CSS class will not show valid message messageTag | tag that will hold the error/valid message messageIdPostfix | message element id = control id + this postfix messageErrorPrefix | show this html before error message itself showAllErrors | show all errors when submitting form; or use "false" to show only first error showValid | show message when valid wait | delay in ms before validating on keyup/keydown; or use "false" to disable it focusScreenOffsetY | vertical screen offset in px to scroll after focusing element with error (useful when using fixed navbar menu which may otherwise obscure the element in focus); or use "false" for default behavior

Special features

  • Form on load validation - Adding class validate-on-load to form element will execute its validation immediately after page is loaded.

Advanced

You can edit/replace methods LiveForm.addError (shows error message), LiveForm.removeError (hides error message), LiveForm.showValid (show message if input is correctly filled), LiveForm.setupHandlers (sets handlers up for inputs, like focus, blur, onkeyup). These methods can be altered to support some JS framework, ie. jQuery.

Maintainers

Authors

This script is based on work of Robert Pösel, zakrava, Radek Ježdík, MartyIX and David Grudl.

Thank you all!


Thank you for testing, reporting and contributing.