Skip to content

Commit b66d797

Browse files
committed
docs: add about field_exists
1 parent 29dfc54 commit b66d797

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

user_guide_src/source/libraries/validation.rst

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,21 @@ for including multiple Rulesets, and collections of rules that can be easily reu
271271
.. note:: You may never need to use this method, as both the :doc:`Controller </incoming/controllers>` and
272272
the :doc:`Model </models/model>` provide methods to make validation even easier.
273273

274+
********************
275+
How Validation Works
276+
********************
277+
278+
- The validation never changes data to be validated.
279+
- The validation checks each field in turn according to the Validation Rules you
280+
set. If any rule returns false, the check for that field ends there.
281+
- The Format Rules do not permit empty string. If you want to permit empty string,
282+
add the ``permit_empty`` rule.
283+
- If a field does not exist in the data to be validated, the value is interpreted
284+
as ``null``. If you want to check that the field exists, add the ``field_exists``
285+
rule.
286+
287+
.. note:: The ``field_exists`` rule can be used since v4.5.0.
288+
274289
************************
275290
Setting Validation Rules
276291
************************
@@ -890,6 +905,8 @@ differs Yes Fails if field does not differ from the one
890905
in the parameter.
891906
exact_length Yes Fails if field is not exactly the parameter ``exact_length[5]`` or ``exact_length[5,8,12]``
892907
value. One or more comma-separated values.
908+
field_exists Yes Fails if field does not exist. (This rule was
909+
added in v4.5.0.)
893910
greater_than Yes Fails if field is less than or equal to ``greater_than[8]``
894911
the parameter value or not numeric.
895912
greater_than_equal_to Yes Fails if field is less than the parameter ``greater_than_equal_to[5]``

0 commit comments

Comments
 (0)