All Projects β†’ iendeavor β†’ Form Validation.js

iendeavor / Form Validation.js

Licence: mit
The most customizable validation framework for JavaScript.

Programming Languages

typescript
32286 projects

Projects that are alternatives of or similar to Form Validation.js

Bootstrap Validate
A simple Form Validation Library for Bootstrap 3 and Bootstrap 4 not depending on jQuery.
Stars: ✭ 112 (-11.81%)
Mutual labels:  validation, validate, form-validation, form
React Hook Form
πŸ“‹ React Hooks for form state management and validation (Web + React Native)
Stars: ✭ 24,831 (+19451.97%)
Mutual labels:  validation, form-validation, form
Ratifier
Ratifier is a form validation library for Android.
Stars: ✭ 123 (-3.15%)
Mutual labels:  validation, easy-to-use, form
Legit
input validation framework
Stars: ✭ 81 (-36.22%)
Mutual labels:  validation, form-validation, form
Approvejs
A simple JavaScript validation library that doesn't interfere
Stars: ✭ 336 (+164.57%)
Mutual labels:  validation, form-validation, form
Just Validate
Lightweight (~4,5kb gzip) form validation in Javascript Vanilla, without dependencies, with customizable rules (including remote validation), customizable messages and customizable submit form with ajax helper.
Stars: ✭ 74 (-41.73%)
Mutual labels:  validation, form-validation, form
Validator.js
β‰οΈθ½»ι‡ηΊ§ηš„ JavaScript 葨单ιͺŒθ―οΌŒε­—符串ιͺŒθ―γ€‚ζ²‘ζœ‰δΎθ΅–οΌŒζ”―ζŒ UMD ,~3kb。
Stars: ✭ 486 (+282.68%)
Mutual labels:  validation, validate, form
Resolvers
πŸ“‹ Validation resolvers: Zod, Yup, Joi, Superstruct, and Vest.
Stars: ✭ 222 (+74.8%)
Mutual labels:  validation, form-validation, form
React Form With Constraints
Simple form validation for React
Stars: ✭ 117 (-7.87%)
Mutual labels:  validation, form-validation, form
Formsy React
A form input builder and validator for React JS
Stars: ✭ 708 (+457.48%)
Mutual labels:  validation, form-validation, form
Validate
A simple jQuery plugin to validate forms.
Stars: ✭ 298 (+134.65%)
Mutual labels:  validation, validate, form
Ok
βœ”οΈ A tiny TypeScript library for form validation
Stars: ✭ 34 (-73.23%)
Mutual labels:  validation, form-validation, form
svelte-form
JSON Schema form for Svelte v3
Stars: ✭ 47 (-62.99%)
Mutual labels:  validation, form, form-validation
Vue Rawmodel
RawModel.js plugin for Vue.js v2. Form validation has never been easier!
Stars: ✭ 79 (-37.8%)
Mutual labels:  promise, validation, form
formalizer
React hooks based form validation made for humans.
Stars: ✭ 12 (-90.55%)
Mutual labels:  validation, form, form-validation
Bunny
BunnyJS - Lightweight native (vanilla) JavaScript (JS) and ECMAScript 6 (ES6) browser library, package of small stand-alone components without dependencies: FormData, upload, image preview, HTML5 validation, Autocomplete, Dropdown, Calendar, Datepicker, Ajax, Datatable, Pagination, URL, Template engine, Element positioning, smooth scrolling, routing, inversion of control and more. Simple syntax and architecture. Next generation jQuery and front-end framework. Documentation and examples available.
Stars: ✭ 473 (+272.44%)
Mutual labels:  validation, form-validation, form
Neoform
βœ… React form state management and validation
Stars: ✭ 162 (+27.56%)
Mutual labels:  validation, form-validation, form
Redux Form
A Higher Order Component using react-redux to keep form state in a Redux store
Stars: ✭ 12,597 (+9818.9%)
Mutual labels:  validation, form-validation, form
Nice Validator
Simple, smart and pleasant validation solution.
Stars: ✭ 587 (+362.2%)
Mutual labels:  validation, validate, form-validation
React Final Form
🏁 High performance subscription-based form state management for React
Stars: ✭ 6,781 (+5239.37%)
Mutual labels:  validation, form-validation, form

form-validation.js

npm version CI Coverage Status gzip visitors

Live Examples

[email protected] + element-ui

back to top

Feature

Intuitive APIs. 🎯

Asynchronous Rules Support.

Nested Object/Aray Support.

Array Manipulations (push, pop, shift, unshift, splice, reverse) Support.

Zero Dependencies, Native Javascript only.

back to top

Overview

const form = {
  account: '',
}

const schema = {
  account: {
    $params: {
      languageCode: 'en',
      minLength: 6,
    },

    $normalizer({ value, key, parent, path, root, params }) {
      return typeof value === 'string' ? value.trim() : ''
    },

    $rules: {
      weak({ value, key, parent, path, root, params }) {
        if (value.length < params.minLength) return 'Too short'
        if (/\W/.test(value)) return 'Must contain special charachar'
      },

      async alreadyBeenUsed({ value, key, parent, path, root, params }) {
        if (value === '') return

        if (await isExists(value)) return false
      },
    },

    $errors: {
      weak({ value, key, parent, path, root, params }) {
        return params.$rules.weak
      },

      alreadyBeenUsed({ value, key, parent, path, root, params }) {
        const languageCode = params.languageCode || 'en-US'
        return translate(`This account has already been used.`, { languageCode })
      },
    },
  },
}

const validator = {}

// in order to track form's data sctructure (e.g., add new property to object, or push new element to array), you should always update your fields from the proxiedForm instead of the original form
const proxiedForm = FormValidation.proxy({ form, schema, validator })

// validate the entire form
await validator.$v.validate()

console.log(validator.$v.invalid)
// > true
console.log(validator.$v.errors.weak)
// > 'Too short.'

back to top

Documentation

back to top

Contributing

Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.

back to top

Versioning

We use SemVer for versioning. For the versions available, see the tags on this repository.

back to top

License

This project is licensed under the MIT License - see the LICENSE file for details

back to top

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].