@divantespzoo/jquery-validation-polish

Additional polish methods for jquery validation plugin


Keywords
jquery, jquery-validation, validation
License
MIT
Install
npm install @divantespzoo/jquery-validation-polish@1.1.0

Documentation

jQuery validation polish

Additional methods for jquery validation library specific to polish websites. More info about jQuery Validation and docs for usage and options: jQuery Validation

Demo

Demo files showing basic plugin usage and some of methods is shown in demo directory.

Usage

You can use additional methods provided by this plugin in few ways. If you use date validators please include date.js libarary. They rely on date functions provided by this lib.

Method 1 - for prototyping, not recommended for production

Use unpkg CDN. Latest version library is available under this link: https://unpkg.com/@divantespzoo/jquery-validation-polish/dist/jquery.validation.polish.js

Before loading this methods you should load jquery and jquery validation. Example:

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.4/jquery.min.js" defer></script>
<script src="https://cdn.jsdelivr.net/jquery.validation/1.16.0/jquery.validate.min.js" defer></script>
<script src="https://unpkg.com/@divantespzoo/jquery-validation-polish/dist/jquery.validation.polish.js" defer></script>

Method 2 - with build system

First install npm module using of the command below:

npm install @divantespzoo/jquery-validation-polish --save

or with Yarn

yarn add @divantespzoo/jquery-validation-polish

If you want to include all available methods in your file after importing jQuery and jQuery validation import following package:

import '@divantespzoo/jquery-validation-polish';

When you need only couple of methods import each one explicitly. You will avoid having unused code in your production files. This method requires your build system to transpile JS for ES5 standard.

Example for address validation:

import '@divantespzoo/jquery-validation-polish/validatorAddress';

Below in each method description import path will be specified.

Available methods

Address

Allows for letters (including polish and german diacritics), digits, white space and special characters: \/,.-"

Class: `js-validation-address`

Default message: `Wprowadź poprawnie adres.`

Import file: `validatorAddress`

Alpha characters with polish and german diacritics

Allow only letters (including polish and german diacritics)

Class: `js-validation-alpha-pl-de`

Default message: `Dozwolone są tylko litery.`

Import file: `validatorAlphaPlDe`

Alpha characters with polish diacritics

Allow only letters (including polish diacritics)

Class: `js-validation-alpha-pl`

Default message: `Dozwolone są tylko litery od a do z.`

Import file: `validatorAlphaPl`

Alpha characters

Allow only letters

Class: `js-validation-alpha`

Default message: `Dozwolone są tylko litery od a do z bez polskich znaków.`

Import file: `validatorAlpha`

Building number

Requires at least 1 number that can be followed by letters, digits, special characters and whitespace.

Class: `js-validation-building-number`

Default message: `Wprowadź poprawnie numer budynku.`

Import file: `validatorBuildingNumber`

City

Requires at 2 letters and then allows for whitespace, special characters like - and more letters

Class: `js-validation-city`

Default message: `Wprowadź poprawnie nazwę miasta.`

Import file: `validatorCity`

Date

Checks if date is correct. Format for date is yyyy-mm-dd. Parts of date can be separated with -\/._

Class: `js-validation-date`

Default message: `Wprowadź poprawną datę`

Import file: `validatorDate`

Date from future

Checks if date is correct and if it is from future. Present date is incorrect.

Class: `js-validation-date-future`

Default message: `Data musi być z przyszłości.`

Import file: `validatorDateFuture`

Prerequisite: method requires date validator. Import it before this one

Date max

Checks if date happened before provided max value.

Default message: `Proszę wprowadzić datę przed ${max}`

Import file: `validatorDateMax`

Recommendation: use date validator to check id date is correct.

Parameters: max date

Date min

Checks if date happened after provided min value.

Default message: `Proszę wprowadzić datę po ${min}`

Import file: `validatorDateMin`

Recommendation: use date validator to check id date is correct.

Parameters: min date

Date not future

Check if date is correct and is not from future(today or past).

Class: `js-validation-date-not-future`

Default message: `Data nie może być z przyszłości.`

Import file: `validatorDateNotFuture`

Prerequisite: method requires date validator. Import it before this one

Date not past

Check if date is correct and is not from past(today or future).

Class: `js-validation-date-not-past`

Default message: `Data nie może być z przeszłości.`

Import file: `validatorDateNotPast`

Prerequisite: method requires date validator. Import it before this one

Date past

Check if date is correct and is from past (not present).

Class: `js-validation-date-past`

Default message: `Data musi być z przeszłości.`

Import file: `validatorDatePast`

Prerequisite: method requires date validator. Import it before this one

Digits

Checks if string contains only digits.

Class: `js-validation-digits`

Default message: `Dozwolone są tylko cyfry.`

Import file: `validatorDigits`

Email

Overrides jQuery validation email validator. Limits string to 320 chars.

Class: `js-validation-email`

Default message: `Wprowadź poprawny adres email.`

Import file: `validatorEmail`

Firstname

Enables Alpha characters with polish and german diacritics validator

Class: `js-validation-firstname`

Default message: same as used in enabled validator

Import file: `validatorFirstname`

Prerequisite: method requires Alpha characters with polish and german diacritics validator. Import it before this one

Firstnames with Lastname

Requires at least one name and lastname. Blocks most of special characters and digits.

Class: `js-validation-firstnames-lastname`

Default message: `Wprowadź poprawnie imię/imiona i nazwisko.`

Import file: `validatorFirstnamesLastname`

Firstnames

Requires at least one name. Blocks most of special characters and digits.

Class: `js-validation-firstnames`

Default message: `Wprowadź poprawnie imię/imiona`

Import file: `validatorFirstnames`

Fullname

Requires firstname and lastname. Blocks most of special characters and digits.

Class: `js-validation-fullname`

Default message: `Wprowadź poprawnie imię i nazwisko`

Import file: `validatorFullname`

Lastname

Requires lastname. Blocks most of special characters and digits.

Class: `js-validation-lastname`

Default message: `Wprowadź poprawnie nazwisko`

Import file: `validatorLastname`

House number

Requires at least one digits. Then it allows for more digits, alpha characters and some special characters -/\

Class: `js-validation-house-number`

Default message: `Wprowadź poprawnie numer mieszkania.`

Import file: `validatorHouseNumber`

KRS

Requires 10 digits

Class: `js-validation-krs`

Default message: `Podaj poprawny numer KRS.`

Import file: `validatorKRS`

Max checked

Allows for only max checked items from form.

Class: `js-validation-max-checked`

Default message: `Proszę zaznaczyć maksymalnie ${maxChecked} pól.`

Import file: `validatorMaxChecked`

Parameters: Provide maximum amount of checked checkboxes in attribute `data-js-validation-max-checked`

Max words

Requires input to have less than max words. Words are seprated with whitespace

Class: `js-validation-max-words`

Default message: `Wprowadź maksymalnie ${max} wyrazów.`

Import file: `validatorMaxWords`

Max length

Overrides maxlength validator with custom message

Default message: `Wprowadź maksymalnie ${max} znaków.`

Import file: `validatorMaxlength`

Min checked

Allow for at least min checked items from form.

Class: `js-validation-min-checked`

Default message: `Proszę zaznaczyć przynajmniej ${minChecked} pól.`

Import file: `validatorMinChecked`

Parameters: Provide minimum of checked checkboxes in attribute `data-js-validation-min-checked`

Min words

Requires input to have at least min words. Words are seprated with whitespace

Class: `js-validation-min-words`

Default message: `Wprowadź przynajmniej ${min} wyrazów.`

Import file: `validatorMinWords`

Min length

Overrides minlength validator with custom message

Default message: `Wprowadź przynajmniej ${min} znaków.`

Import file: `validatorMinlength`

NIP

Checkes if number is correct NIP code

Class: `js-validation-nip`

Default message: `Proszę wpisać poprawny numer NIP`

Import file: `validatiorNIP`

Number between min and max

Checks if number is correct and if between min and max

Default message: `Proszę wpisać wartość pomiędzy ${min} i ${max}.`

Import file: `validatorNumberBetween`

Parameters: min value, max value

Number integer

Checks if number is integer

Class: `js-validation-number-integer`

Default message: `Proszę wpisać liczbę całkowitą.`

Import file: `validatorNumberInteger`

Number max

Checks if number is less or equals to max

Default message: `Proszę wpisać wartość mniejszą lub równą ${max}.`

Import file: `validatorNumberMax`

Parameters: max value

Number min

Checks if number is more or equal to min

Default message: `Proszę wpisać wartość większą lub równą ${min}.

Import file: `validatorNumberMin`

Parameters: min value

Number not negative

Checks if number is equals or more than 0

Class: `js-validation-number-not-negative`

Default message: `Proszę wpisać poprawną liczbę.`

Import file: `validatorNumberNotNegative`

Number positive

Checks if number is bigger than 0

Class: `js-validation-number-positive`

Default message: `Proszę wpisać poprawną liczbę.`

Import file: `validatorNumberPositive`

Number

Checks if value is correct number

Class: `js-validation-number`

Default message: `Proszę wpisać poprawną liczbę.`

Import file: `validatorNumber`

PESEL

Checks if value is correct PESEL code

Class: `js-validation-pesel`

Default message: `Proszę wpisać poprawny numer PESEL`

Import file: `validatorPESEL`

Phone

Checks if value is correct phone number

Class: `js-validation-phone`

Default message: `Podaj poprawny numer telefonu.`

Import file: `validatorPhone`

Postal code

Checks if value is in polish postal format

Class: `js-validation-postal-code`

Default message: `Wprowadź poprawnie kod pocztowy.`

Import file: `validatorPostalCode`

Range checked

Checks if checkboxes number between min and max was checked in form

Class: `js-validation-range-checked`

Default message: `Proszę zaznaczyć od ${min} do ${max} pól.`

Import file: `validatorRangeChecked`

Parameters: min checked amount in `data-js-validation-min-checked` and max checked amount in `data-js-validation-max-checked`

Range length

Overrides message for length check of input between min and max

Default message: `Wprowadź od ${min} do ${max} znaków.`

Import file: `validatorRangeLength`

Range words

Checks if words count is between min and max

Default message: `Wprowadź od ${min} do ${max} wyrazów.`

Import file: `validatorRangeWords`

Parameters: min amount, max amount

REGON

Checks if value is correct REGON code

Class: `js-validation-regon`

Default message: `Podaj poprawny REGON.`

Import file: `validatorREGON`

Repeat email

Checks if two fields represent same email address

Default message: `Adresy email się nie zgadzają.`

Import file: `validatorRepeatEmail`

Parameters: jQuery element pointing other email field

Repeat field

Checks if two fields have the exact same values

Default message: `Pola się nie zgadzają.`

Import file: `validatorRepeatField`

Parameters: jQuery element pointing other field

Require from group

Checks if at least min amount of field was filled from group

Default message: `Proszę wypełnić przynajmniej ${min} pól z grupy.`

Import file: `validatorRequireFromGroup`

Parameters: amount of fields from group, fields identifier

Street

Checks if value is correct street name

Class: `js-validation-street`

Default message: `Wprowadź poprawnie nazwę ulicy.`

Import file: `validatorStreet`

URL

Overrider url validator message

Default message: `Wprowadź poprawny link.`

Import file: `validatorURL`

About Authors

Divante-logo

We are a Software House from Europe, headquartered in Poland and employing about 150 people. Our core competencies are built around Magento, Pimcore and bespoke software projects (we love Symfony3, Node.js, Angular, React, Vue.js). We specialize in sophisticated integration projects trying to connect hardcore IT with good product design and UX.

Visit our website Divante.co for more information.