From c672b2bd307ee9739387258cbd20241bd3c29583 Mon Sep 17 00:00:00 2001 From: Donatas Glodenis Date: Sun, 24 Sep 2023 13:06:10 +0300 Subject: [PATCH 1/4] Add note on incompatibility of general rules for file validation use --- user_guide_src/source/libraries/validation.rst | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/user_guide_src/source/libraries/validation.rst b/user_guide_src/source/libraries/validation.rst index 3224961e0821..1d73f3b8aaae 100644 --- a/user_guide_src/source/libraries/validation.rst +++ b/user_guide_src/source/libraries/validation.rst @@ -971,6 +971,9 @@ Rule Parameter Description ======================= ========== ============================================= =================================================== uploaded Yes Fails if the name of the parameter does not ``uploaded[field_name]`` match the name of any uploaded files. + Prevents form from validating if file upload + is required. + max_size Yes Fails if the uploaded file named in the ``max_size[field_name,2048]`` parameter is larger than the second parameter in kilobytes (kb). Or if the file @@ -992,3 +995,7 @@ is_image Yes Fails if the file cannot be determined to be ======================= ========== ============================================= =================================================== The file validation rules apply for both single and multiple file uploads. + +.. note:: Only rules specifically created for file validation (like the ones listed in the table above) can be used to validate files. + Therefore, adding any general rules, like ``permit_empy``, to file validation rules array or string will prevend all rules for the + from file from being processed during validation. From 20b496b057cbc97fd929298d9ca8d8720df91dac Mon Sep 17 00:00:00 2001 From: Donatas Glodenis Date: Wed, 4 Oct 2023 17:36:39 +0300 Subject: [PATCH 2/4] Implement proposed fixes for previous suggestions --- user_guide_src/source/libraries/validation.rst | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/user_guide_src/source/libraries/validation.rst b/user_guide_src/source/libraries/validation.rst index 1d73f3b8aaae..a527dada391c 100644 --- a/user_guide_src/source/libraries/validation.rst +++ b/user_guide_src/source/libraries/validation.rst @@ -971,8 +971,8 @@ Rule Parameter Description ======================= ========== ============================================= =================================================== uploaded Yes Fails if the name of the parameter does not ``uploaded[field_name]`` match the name of any uploaded files. - Prevents form from validating if file upload - is required. + If you want the file upload to be optional (not required), + do not define this rule. max_size Yes Fails if the uploaded file named in the ``max_size[field_name,2048]`` parameter is larger than the second @@ -997,5 +997,5 @@ is_image Yes Fails if the file cannot be determined to be The file validation rules apply for both single and multiple file uploads. .. note:: Only rules specifically created for file validation (like the ones listed in the table above) can be used to validate files. - Therefore, adding any general rules, like ``permit_empy``, to file validation rules array or string will prevend all rules for the - from file from being processed during validation. + Therefore, adding any general rules, like ``permit_empy``, to file validation rules array or string, the file validation will not + work correctly. From db7041cdb1d2cb5eb09684e50efa8e0494f31343 Mon Sep 17 00:00:00 2001 From: Donatas Glodenis Date: Fri, 6 Oct 2023 09:49:53 +0300 Subject: [PATCH 3/4] correct table format --- user_guide_src/source/libraries/validation.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/user_guide_src/source/libraries/validation.rst b/user_guide_src/source/libraries/validation.rst index a527dada391c..7a26a41d49fc 100644 --- a/user_guide_src/source/libraries/validation.rst +++ b/user_guide_src/source/libraries/validation.rst @@ -971,8 +971,8 @@ Rule Parameter Description ======================= ========== ============================================= =================================================== uploaded Yes Fails if the name of the parameter does not ``uploaded[field_name]`` match the name of any uploaded files. - If you want the file upload to be optional (not required), - do not define this rule. + If you want the file upload to be optional + (not required), do not define this rule. max_size Yes Fails if the uploaded file named in the ``max_size[field_name,2048]`` parameter is larger than the second From fde934ee87485d0b0e47b074690d99fcc0040bec Mon Sep 17 00:00:00 2001 From: kenjis Date: Tue, 24 Oct 2023 11:06:51 +0900 Subject: [PATCH 4/4] docs: fix typo --- user_guide_src/source/libraries/validation.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/user_guide_src/source/libraries/validation.rst b/user_guide_src/source/libraries/validation.rst index 7a26a41d49fc..739d51b3fe6a 100644 --- a/user_guide_src/source/libraries/validation.rst +++ b/user_guide_src/source/libraries/validation.rst @@ -997,5 +997,5 @@ is_image Yes Fails if the file cannot be determined to be The file validation rules apply for both single and multiple file uploads. .. note:: Only rules specifically created for file validation (like the ones listed in the table above) can be used to validate files. - Therefore, adding any general rules, like ``permit_empy``, to file validation rules array or string, the file validation will not + Therefore, adding any general rules, like ``permit_empty``, to file validation rules array or string, the file validation will not work correctly.