Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Added new page for form validation * Update src/guides/v2.2/frontend-dev-guide/validations/form-validation.md Co-Authored-By: Jeff Matthews <matthews.jeffery@gmail.com> * Update src/guides/v2.2/frontend-dev-guide/validations/form-validation.md Co-Authored-By: Jeff Matthews <matthews.jeffery@gmail.com> * Update src/guides/v2.2/frontend-dev-guide/validations/form-validation.md Co-Authored-By: Jeff Matthews <matthews.jeffery@gmail.com> * Added contributor credit * Fixed linting issues
- Loading branch information
1 parent
1421470
commit ed2fbcb
Showing
3 changed files
with
31 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
src/guides/v2.2/frontend-dev-guide/validations/form-validation.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
--- | ||
group: frontend-developer-guide | ||
title: Form validation | ||
contributor_name: Adarsh Manickam | ||
contributor_link: https://github.com/drpayyne | ||
functional_areas: | ||
- Frontend | ||
--- | ||
|
||
The Magento application provides various ways to validate your form inputs. This implementation is based, and extends, [jQuery Validation](https://jqueryvalidation.org/documentation). | ||
|
||
## Validation Module Structure | ||
|
||
There are three main validation modules present in Magento: `jquery/validate`, `mage/validation`, and `mage/validation/validation`. | ||
|
||
### `jquery/validate` | ||
|
||
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. | ||
|
||
### `mage/validation` | ||
|
||
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. | ||
|
||
### `mage/validation/validation` | ||
|
||
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. | ||
|
1 change: 1 addition & 0 deletions
1
src/guides/v2.3/frontend-dev-guide/validations/form-validation.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../../v2.2/frontend-dev-guide/validations/form-validation.md |