Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ed2fbcb

Browse files
drpayynejeff-matthews
authored andcommitted
New Page: Form Validation (magento#6226)
* Added new page for form validation * Update src/guides/v2.2/frontend-dev-guide/validations/form-validation.md Co-Authored-By: Jeff Matthews <[email protected]> * Update src/guides/v2.2/frontend-dev-guide/validations/form-validation.md Co-Authored-By: Jeff Matthews <[email protected]> * Update src/guides/v2.2/frontend-dev-guide/validations/form-validation.md Co-Authored-By: Jeff Matthews <[email protected]> * Added contributor credit * Fixed linting issues
1 parent 1421470 commit ed2fbcb

File tree

3 files changed

+31
-0
lines changed

3 files changed

+31
-0
lines changed

src/_data/toc/frontend-developer-guide.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,9 @@ pages:
178178
- label: Example theme translation dictionary
179179
url: /frontend-dev-guide/translations/translate_practice.html
180180

181+
- label: Form validation
182+
url: /frontend-dev-guide/validations/form-validation.html
183+
181184
- label: Tools
182185
include_versions: ["2.2", "2.3"]
183186
url: /frontend-dev-guide/tools/tools_overview.html
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
---
2+
group: frontend-developer-guide
3+
title: Form validation
4+
contributor_name: Adarsh Manickam
5+
contributor_link: https://github.com/drpayyne
6+
functional_areas:
7+
- Frontend
8+
---
9+
10+
The Magento application provides various ways to validate your form inputs. This implementation is based, and extends, [jQuery Validation](https://jqueryvalidation.org/documentation).
11+
12+
## Validation Module Structure
13+
14+
There are three main validation modules present in Magento: `jquery/validate`, `mage/validation`, and `mage/validation/validation`.
15+
16+
### `jquery/validate`
17+
18+
This is an alias for [`lib/web/jquery/jquery.validate`]({{ site.mage2bloburl }}/{{ page.guide_version }}/lib/web/jquery/jquery.validate.js). This is the base validation JavaScript file provided by jQuery that Magento extends.
19+
20+
### `mage/validation`
21+
22+
This module is present at [`lib/web/mage/validation.js`]({{ site.mage2bloburl }}/{{ page.guide_version }}/lib/web/mage/validation.js). This module includes `jquery/validate` and adds various functions, such as `$.validator.addMethod`, which can be used by mixins to add custom validation rules, a base set of rules to validate, the `mage.validation` widget, and more.
23+
24+
### `mage/validation/validation`
25+
26+
This module is present at [`lib/web/mage/validation/validation.js`]({{ site.mage2bloburl }}/{{ page.guide_version }}/lib/web/mage/validation/validation.js). This is considered the entry point for the form validator in Magento and is aliased as `validation` at [`Magento_Theme/view/frontend/requirejs-config.js`]({{ site.mage2bloburl }}/{{ page.guide_version }}/app/code/Magento/Theme/view/frontend/requirejs-config.js#L29). This includes `mage/validation` (which in turn includes `jquery/validate`), and adds a few more rules to the validator.
27+
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../../v2.2/frontend-dev-guide/validations/form-validation.md

0 commit comments

Comments
 (0)