Validate your forms, frontend, without writing a single line of javascript

Overview

Parsley

Build Status

JavaScript form validation, without actually writing a single line of JavaScript!

Version

2.9.2

Doc

See index.html and doc/

Requirements

jQuery >= 1.8 (compatible with 2.x and 3.0) es5-shim if you want need to support IE8

Questions?

Please ask questions on StackOverflow and be sure to include the parsley.js tag. Please provide an example, starting for example from this jsfiddle

Contributing

See the CONTRIBUTING.md file

Integrations

Create integration with other framework as a separate Github repo and send a pull request for including here. Some integrations are

Install dev environment and running tests

First time: install npm and:

npm install -g gulp

then

npm install
gulp test

Build dist/ and doc/annotated-source

gulp build

Run tests

In the browser: run a server with gulp test-browser, then open test/runner.html

In the terminal: gulp test

License

Released under the MIT License. See the bundled LICENSE file for details.

Comments
  • [WIP] es6 with babel/generator-babel-boilerplate

    [WIP] es6 with babel/generator-babel-boilerplate

    ES6

    Use es6 for Parsley development and build it fully transpiled into dist/. Should lead to 2.3.0 version which do not bring any new feature nor BC break.

    TODO

    • [x] es6 boilerplate (gulp/grunt tasts)
    • [x] adapt Parsley files
    • [x] adapt test suite
    • [ ] profit
    opened by guillaumepotier 34
  • parsley very slow on large form

    parsley very slow on large form

    Hello,

    parsley is very slow on form with around 100 - 200 inputs. it's take around 1000 ms for the dom to complete. I do like this

    $(document).ready(function(){
      $myForm.parsley();
    });
    

    i guess it's because $myForm.parsley(); will modify the dom mostly by adding/removing new elements. this effect of updating the dom is very slow (and bad) ! maybe it's better to add the new elements when they are actually need. exemple empty elements like <ul id="parsley-id-9096" class="parsley-errors-list"></ul> are they really necessary before an error is raised ?

    bug ongoing 
    opened by Zeus64 34
  • Remote parsley should have option to disable caching

    Remote parsley should have option to disable caching

    Currently parsley remote caches every response and that can be a problem. For example I am working on a single page app and when creating user I am checking is email unique so this happens:

    1. I normally create user with email which wasn't used earlier (parsley response is cached)
    2. I try to create user with same email again and since response is cached it passes validation again
    bug 
    opened by jbojcic1 32
  • Parsley.remote loading problem

    Parsley.remote loading problem

    Hi, I upgraded to the last version and I use parsley.remote instead parsley but when I load the script through requirejs I have an error

    Uncaught TypeError: Cannot read property 'on'

    caused by this code at line 2065 in parsley.remote.js

    window.Parsley.on('form:submit', function () { this._remoteCache = {}; });

    Any idea?

    opened by alessandroliveri 27
  • parsley().on('field:success') not working

    parsley().on('field:success') not working

    Really not sure what's going on, I'm using the latest version of jquery and it's possible there is some kind of conflict.

    But the following is not working or being fired

    $('#quantity').parsley().on('field:success', function() {
            console.log('success');
    });
    

    But this does work

        $( "#quantity" ).change(function() {
            console.log('change');
            $('#quantity').parsley().validate();
        });
    

    I see the validation

    This is also not working 
      if (false === $('#create-post').parsley().validate('step' + current)) {
                        console.log('false');
                        return false;
    } 
    
    opened by isAlmogK 25
  • Conflation of type=

    Conflation of type="number" and parsley-type="number"

    This is for version 1.2.3.

    The implementation of type="number" and parsley-type="number" is supposed to be the same, according to the documentation.

    However, the implementations are not the same. A test case is the number 4.5. It will pass parsley's validation, but not HTML5's.

    Test page for HTML5's input type="number": http://www.w3schools.com/html/tryit.asp?filename=tryhtml5_input_type_number

    bug enhancement question ongoing 
    opened by pipes161 25
  • Parsley feedback survey for Parsley2

    Parsley feedback survey for Parsley2

    Hi there,

    I've pushed 2.0-dev here: http://guillaumepotier.github.io/parsley2-doc/

    I'll keep it updated while developing Parsley2 and updating doc / tests, meanwhile, feel free to have a look, test and put your feedbacks here :)

    Best

    enhancement question ongoing 
    opened by guillaumepotier 25
  • Remove sourcemaps from distribution files.

    Remove sourcemaps from distribution files.

    What kind of issue is this? (put 'x' between the square brackets)

    • [ ] Question. This issue tracker is not the place for questions. If you want to ask how to do something, or to understand why something isn't working the way you expect it to, use http://stackoverflow.com/questions/ask . Provide working code, starting from http://codepen.io/marcandre/pen/jqbzyN?editors=101. We monitor the tag parsley.js.
    • [ ] Bug report. If you’ve found a bug, you must provide a minimal example in a CodePen, starting from http://codepen.io/marcandre/pen/jqbzyN?editors=101 .
    • [x] Feature Request. Make sure there's no good way to do what you want first; consider asking on http://stackoverflow.com/questions/ask first.

    Hi, so I use bower, and bower installer to install dependencies, when requesting distribution files I don't require the sourcemap, however because the sourcemap is not included in the bower file as a main file it doesn't get installed by bower installer causing my grunt tasks to fail due to the missing sourcemap.

    Can you either exclude sourcemaps from distribution files, or include the sourcemap in bower.json as a main file? Preferably the former as I have no requirement for source maps in production code.

    Thanks! :)

    opened by dahliacreative 23
  • Floating number validation

    Floating number validation

    What kind of issue is this? (put 'x' between the square brackets)

    • [ ] Question. This issue tracker is not the place for questions. If you want to ask how to do something, or to understand why something isn't working the way you expect it to, use http://stackoverflow.com/questions/ask . Provide working code, starting from http://codepen.io/marcandre/pen/jqbzyN?editors=101. We monitor the tag parsley.js.
    • [x] Bug report. If you’ve found a bug, you must provide a minimal example in a CodePen, starting from http://codepen.io/marcandre/pen/jqbzyN?editors=101 .
    • [ ] Feature Request. Make sure there's no good way to do what you want first; consider asking on http://stackoverflow.com/questions/ask first.

    I think I found a bug with floating number validation. Here is a CodePen to illustrate it: http://codepen.io/cgrimal/pen/jApoyO?editors=1010

    The data-parsley-type="number" is not validating any number input with a . I read the docs, and tried many things but I can't make it work. One thing that may help you: it works if you use release 2.2.0-rc4 and the problem starts with release 2.2.0.

    I'll use 2.2.0-rc4 for the time being but I'm willing to understand if it is a genuine bug of the lib or me!

    Thanks guys, Clément

    opened by cgrimal 17
  • added ability to change remote options on the fly

    added ability to change remote options on the fly

    When trying to validated a field together with an adjacent field, the parsley:field:validate is simply not powerful enough to allow you to send additional data dynamically and neither is the data-parsley-remote-options attribute.

    This applies, for example, when remotely validating international phone numbers which require the user to also select the country in order to apply formatting rules.

    // this fails and data is never sent
    $.listen('parsley:field:validate', function (field) {
      if (field === someRefToMyField) {
        field.options.remoteOptions.data = {someName: $someField.val()};
      }
    });
    // this works
    $.listen('parsley:remote:options', function (field, options) {
      if (field === someRefToMyField) {
        options.data = {someName: $someField.val()};
      }
    });
    
    opened by DiliBau 17
  • Option to silence error messages inside form

    Option to silence error messages inside form

    Hi,

    would it be possible to add an option to order Parsley not to report error messages? My use case is this: I use my own form builder to create forms, that displays errors in designated place inside form. Hooking Parsley inside my code was easy but I had to silence its reports by:

    parsley-error-list {
      display:        none !important;
    }
    

    All I'm interested is "tell me if all values are valid or not", or better "tell me what fields contain invalid values" - I'll report this to user my own way. Parsley does it's validation job perfectly (for my needs, at least :) but talks too much :) Using CSS to silence Parsley works, no doubt about that, but I just thought it'd be nice to have an option for this behavior - it'd be more straightforward, readable and understandable.

    waiting confirmation 
    opened by happz 17
  • Listening for any error messages

    Listening for any error messages

    I try to listen for an error in the second field. I have an issue it will not be added a class to the button. Is it technically possible to do this? A button is pushed on the second element under an error but an error is under input cell. So, I try to add a new class to the button when an error arise for the second element. I have used if (input.dataset.parsleyId === '13') ` $(document).ready(function() { var parsleyConfig = { errorsContainer: function(parsleyField) { return $('#errors'); } };

    $("form").parsley(parsleyConfig); if (input.dataset.parsleyId === '13') { button.setAttribute("class", "fixed-margin-button1"); }

    $("form").on('submit', function(e) { var f = $(this); f.parsley().validate();

    if (f.parsley().isValid()) {
     alert('The form is valid');
    } else {
     alert('There are validation errors');
    }
    
    e.preventDefault();
    

    } ); } ); `

    opened by toplisek 0
  • using data-parsley-trigger=

    using data-parsley-trigger="blur" stop 'click event' from being executed

    What kind of issue is this? (put 'x' between the square brackets)

    https://codepen.io/code-prashant/pen/RwgPaQV?editors=101

    once the codepen loads keep focus in Please enter a palindrome: field now scroll and click on 'click me link'

    issue: alert not fired. click again and alert is fired

    • [x] Bug report. If you’ve found a bug, you must provide a minimal example in a CodePen, https://codepen.io/code-prashant/pen/RwgPaQV?editors=101.
    bug 
    opened by pkc112 2
  • URL validator does not permit underscores in the domain

    URL validator does not permit underscores in the domain

    What kind of issue is this? (put 'x' between the square brackets)

    • [ ] Question. This issue tracker is not the place for questions. If you want to ask how to do something, or to understand why something isn't working the way you expect it to, use http://stackoverflow.com/questions/ask . Provide working code, starting from http://codepen.io/marcandre/pen/jqbzyN?editors=101. We monitor the tag parsley.js.

    • [x] Bug report. If you’ve found a bug, you must provide a minimal example in a CodePen, starting from http://codepen.io/marcandre/pen/jqbzyN?editors=101 .

    • [ ] Feature Request. Make sure there's no good way to do what you want first; consider asking on http://stackoverflow.com/questions/ask first.

    I am having problems validating a URL containing an underscore, they are coming back as invalid according to Parsley.

    I have checked the regex Parsley uses: https://github.com/guillaumepotier/Parsley.js/blob/master/src/parsley/validator_registry.js#L53

    It does appear that it disallows an underscore.

    I went on to try to find out what the deal with underscores in URLs is, and I have not been able to find an absolute clear answer:

    • RFC1738 says they are not allowed
    • The URI spec says that they are allowed
    • In various places I have read that hostnames do not allow underscores but domain names do.

    The conclusion is that it's a mess, and I genuinely have no idea if they are valid, after spending most of a day trying to find out.

    But, there is a more practical issue, which is that nonetheless URLs with underscores do exist, and my browser will resolve them, so that seems like a fairly good test that they are allowed, if not in spec, then at least "in the wild". Here's an example of such a URL: https://imuk_eng.pnzgu.ru/

    So, I need to get my form to permit them, which it currently doesn't.

    The best answer is that Parsley's type=url validator would allow underscores in URLs, and I don't know how feasible that is.

    The second best answer is that I could override the Parsley URL regex with my own weakened version which allows underscores. I haven't found a clean way to do that yet, short or removing and then replacing the type validator with my own one, which I don't want to do, as I think I'd need to copy a lot of Parsley internal code.

    Is there a way to replace https://github.com/guillaumepotier/Parsley.js/blob/master/src/parsley/validator_registry.js#L31 at runtime?

    Thanks!

    opened by richard-jones 7
  • Remove deprecated deferred.pipe()

    Remove deprecated deferred.pipe()

    As demonstrated by https://github.com/guillaumepotier/Parsley.js/issues/1226, Parsley.js still uses the deprecated function deferred.pipe

    There has been a fix before: https://github.com/guillaumepotier/Parsley.js/pull/1253 That fix has been retracted because it doesn't pass the test suite. This fix removes deferred.pipe and still passes all the tests.

    opened by partiellkorrekt 2
  • What are the accepted values for 'assert' in addError method?

    What are the accepted values for 'assert' in addError method?

    In the docs we can use the addError method to programmatically add an error to a field: addError(name, {message: , assert: , updateClass: true});

    One of the properties we can pass is assert what is assert and what values does it accept? I cannot find the answer for this anywhere.

    Thanks!

    opened by gregg-cbs 3
  • Validation Occurs Even on Disabled Elements

    Validation Occurs Even on Disabled Elements

    What kind of issue is this? (put 'x' between the square brackets)

    • [ ] Question. This issue tracker is not the place for questions. If you want to ask how to do something, or to understand why something isn't working the way you expect it to, use http://stackoverflow.com/questions/ask . Provide working code, starting from http://codepen.io/marcandre/pen/jqbzyN?editors=101. We monitor the tag parsley.js.

    • [x ] Bug report. If you’ve found a bug, you must provide a minimal example in a CodePen, starting from http://codepen.io/marcandre/pen/jqbzyN?editors=101 .

    • [ ] Feature Request. Make sure there's no good way to do what you want first; consider asking on http://stackoverflow.com/questions/ask first.

    It looks like Parsley validates disabled form elements. I suppose this issue may fall into the "feature" category if this behavior is intended, however, my gut tells me, that a disabled form field should not be validated.

    Here's an example codepen: https://codepen.io/homestar9/pen/NWrYYyZ

    Here's an animation of the issue: https://i.imgur.com/SUvfl99.gif

    opened by homestar9 1
Releases(2.9.2)
Owner
Guillaume Potier
Guillaume Potier
[DISCONTINUED] jQuery plugin that makes it easy to validate user input while keeping your HTML markup clean from javascript code.

jQuery Form Validator [DISCONTINUED] Validation framework that let's you configure, rather than code, your validation logic. I started writing this pl

Victor Jonsson 976 Dec 30, 2022
The best @jquery plugin to validate form fields. Designed to use with Bootstrap + Zurb Foundation + Pure + SemanticUI + UIKit + Your own frameworks.

FormValidation - Download http://formvalidation.io - The best jQuery plugin to validate form fields, designed to use with: Bootstrap Foundation Pure S

FormValidation 2.8k Mar 29, 2021
Validate properties and well known annotations in your Backstage catalog-info.yaml files.

Backstage entity validator This package can be used as a GitHub action or a standalone node.js module GitHub action Inputs path Optional Path to the c

Roadie 39 Dec 26, 2022
A simple and composable way to validate data in JavaScript (and TypeScript).

A simple and composable way to validate data in JavaScript (and TypeScript). Usage • Why? • Principles • Demo • Examples • Documentation Superstruct m

Ian Storm Taylor 6.3k Jan 9, 2023
Validate for XML schema and returns all the possible failures

detailed-xml-validator Validate for XML schema and returns all the possible failures Sample Rules file <?xml version = "1.0"?> <students nillable="fa

Natural Intelligence 11 Dec 20, 2022
This Login Form made using React hooks , React Js , Css, Json. This form have 3 inputs, it also validate those inputs & it also having length limitations.

Getting Started with Create React App This project was bootstrapped with Create React App. Available Scripts In the project directory, you can run: np

Yogesh Sharma 0 Jan 3, 2022
Validate graphql operations against a schema

@graphql-validate With the power of GraphQL-Tools and GraphQL-JS, we are able to provide a smooth experience for validation your GraphQL operations du

Saihajpreet Singh 13 Dec 23, 2022
A library for validate a string using regular expressions.

Fogex Form Regex Quickly and easily check if the content is valid. Installation npm install fogex or yarn add fogex Usage import fogex from 'fogex';

null 5 May 5, 2022
A simple library to validate Mexican CURPs (Personal ID)

Validate CURP A simple and lightweight library to validate Mexican CURPs (Personal ID). Install NodeJS Use NPM: $ npm install --save validate-curp Or

Manuel de la Torre 15 Nov 24, 2022
🪄 Multi step forms with in built validations

react-wizardry is a data-driven smart wizard component for creating powerful forms with in built validations. Demo Features ⚡ Data driven API ✅ In bui

Prabhu Murthy 38 Aug 16, 2022
Command line utility to split OpenAPI documents into smaller, self contained, service oriented documents and prepare StackQL provider interfaces

openapi-doc-util Command line utility to split OpenAPI documents into smaller, self contained, service oriented documents and prepare StackQL provider

StackQL Studios 9 Sep 29, 2022
What does the Cosmos Hub validator set looks like without ICF delegations?

This is a Next.js project bootstrapped with create-next-app. Getting Started First, run the development server: npm run dev # or yarn dev Open http://

Made in Block 2 Sep 2, 2022
Simple translation for your javascripts, yummy with your favorite templates engine like EJS.

jsperanto Simple translation for your javascripts, yummy with your favorite templates engine like EJS. Pluralization, interpolation & "nested lookup"

Jean-Philippe Joyal 62 Oct 21, 2021
DiscordEmailVerifier - Quickly verify emails on your tokens for completely free using mail.tm's api.

DiscordEmailVerifier Quickly verify emails on your tokens for completely free using mail.tm's api. /* ❗ No, this code doesn't verify the email for you

eric 3 Jun 7, 2022
Copypaster Has your project structure gotten so complex that to add a new feature you need to copy

Copypaster Has your project structure gotten so complex that to add a new feature you need to copy, paste and rename tens or hundreds of files each ti

null 2 Nov 4, 2022
Codestamp - Stamp and verify your files and contents

A language-agnostic tool for signing and verifying your (codegen'd) files and contents.

Keyan Zhang 4 Jan 26, 2022
The Vue form assembly tool that won't break your heart 💔

Loveform The Vue form assembly tool that won't break your heart ?? Loveform is a tool that helps you build validated forms in Vue 3 without the need t

Daniel Leal 16 Jun 10, 2022
Themis is a validation and processing library that helps you always make sure your data is correct.

Dataffy Themis - The advanced validation library Themis is a validation and processing library that helps you always make sure your data is correct. ·

Dataffy 14 Oct 27, 2022