From dd6c0a765cc7ab3a93363f48ad59fac67bee82cb Mon Sep 17 00:00:00 2001 From: Philipp Rieber Date: Thu, 9 Jan 2014 10:23:14 +0100 Subject: [PATCH 1/3] [Reference][Form Types] Add missing options for "form" type --- reference/forms/types/form.rst | 5 +++++ .../types/options/extra_fields_message.rst.inc | 9 +++++++++ reference/forms/types/options/pattern.rst.inc | 16 ++++++++++++++++ .../types/options/post_max_size_message.rst.inc | 12 ++++++++++++ 4 files changed, 42 insertions(+) create mode 100644 reference/forms/types/options/extra_fields_message.rst.inc create mode 100644 reference/forms/types/options/pattern.rst.inc create mode 100644 reference/forms/types/options/post_max_size_message.rst.inc diff --git a/reference/forms/types/form.rst b/reference/forms/types/form.rst index dfe67119f6c..43ab188086a 100644 --- a/reference/forms/types/form.rst +++ b/reference/forms/types/form.rst @@ -59,3 +59,8 @@ on all fields. .. include:: /reference/forms/types/options/invalid_message_parameters.rst.inc +.. include:: /reference/forms/types/options/extra_fields_message.rst.inc + +.. include:: /reference/forms/types/options/post_max_size_message.rst.inc + +.. include:: /reference/forms/types/options/pattern.rst.inc diff --git a/reference/forms/types/options/extra_fields_message.rst.inc b/reference/forms/types/options/extra_fields_message.rst.inc new file mode 100644 index 00000000000..d130808191c --- /dev/null +++ b/reference/forms/types/options/extra_fields_message.rst.inc @@ -0,0 +1,9 @@ +extra_fields_message +~~~~~~~~~~~~~~~~~~~~ + +**type**: ``string`` **default**: ``This form should not contain extra fields.`` + +This is the validation error message that's used if the submitted form data +contains one or more fields that are not part of the form definition. The +placeholder ``{{ extra_fields }}`` can be used to display a comma separated +list of the submitted extra field names. diff --git a/reference/forms/types/options/pattern.rst.inc b/reference/forms/types/options/pattern.rst.inc new file mode 100644 index 00000000000..dcbfa8fe688 --- /dev/null +++ b/reference/forms/types/options/pattern.rst.inc @@ -0,0 +1,16 @@ +pattern +~~~~~~~ + +**type**: ``string`` **default**: ``null`` + +This option adds a ``pattern`` attribute to restrict the field input by a +regular expression. + +.. caution: + + This validation is client-side only. + +.. note: + + When using validation constraints, this option is set automatically + for some constraints to match the server-side validation. diff --git a/reference/forms/types/options/post_max_size_message.rst.inc b/reference/forms/types/options/post_max_size_message.rst.inc new file mode 100644 index 00000000000..23e249a69cc --- /dev/null +++ b/reference/forms/types/options/post_max_size_message.rst.inc @@ -0,0 +1,12 @@ +post_max_size_message +~~~~~~~~~~~~~~~~~~~~~ + +**type**: ``string`` **default**: ``The uploaded file was too large. Please try to upload a smaller file.`` + +This is the validation error message that's used if submitted POST form data +exceeds php.ini's ``post_max_size``. The ``{{ max }}`` placeholder can be used +to display the allowed size. + +.. note: + + Validating the ``post_max_size`` only happens on the root form. From d066f4d9e7518462c837d846a59bc5b8fc1ffcd9 Mon Sep 17 00:00:00 2001 From: Philipp Rieber Date: Sat, 11 Jan 2014 06:45:39 +0100 Subject: [PATCH 2/3] Improvements after review --- reference/forms/types/options/pattern.rst.inc | 7 ++++--- .../forms/types/options/post_max_size_message.rst.inc | 4 ++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/reference/forms/types/options/pattern.rst.inc b/reference/forms/types/options/pattern.rst.inc index dcbfa8fe688..cbef05d6db2 100644 --- a/reference/forms/types/options/pattern.rst.inc +++ b/reference/forms/types/options/pattern.rst.inc @@ -3,12 +3,13 @@ pattern **type**: ``string`` **default**: ``null`` -This option adds a ``pattern`` attribute to restrict the field input by a -regular expression. +This adds an HTML5 ``pattern`` attribute to restrict the field input by a +given regular expression. .. caution: - This validation is client-side only. + The ``pattern`` attribute provides client-side validation for convenience + purposes only and cannot replace a reliable server-side validation. .. note: diff --git a/reference/forms/types/options/post_max_size_message.rst.inc b/reference/forms/types/options/post_max_size_message.rst.inc index 23e249a69cc..f85cb83a99d 100644 --- a/reference/forms/types/options/post_max_size_message.rst.inc +++ b/reference/forms/types/options/post_max_size_message.rst.inc @@ -4,8 +4,8 @@ post_max_size_message **type**: ``string`` **default**: ``The uploaded file was too large. Please try to upload a smaller file.`` This is the validation error message that's used if submitted POST form data -exceeds php.ini's ``post_max_size``. The ``{{ max }}`` placeholder can be used -to display the allowed size. +exceeds ``php.ini``'s ``post_max_size`` directive. The ``{{ max }}`` +placeholder can be used to display the allowed size. .. note: From a42e9711010ffaf037a9705de3343313648e6380 Mon Sep 17 00:00:00 2001 From: Philipp Rieber Date: Sat, 11 Jan 2014 10:32:52 +0100 Subject: [PATCH 3/3] Improve wording --- reference/forms/types/options/pattern.rst.inc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/reference/forms/types/options/pattern.rst.inc b/reference/forms/types/options/pattern.rst.inc index cbef05d6db2..d1ff3aea732 100644 --- a/reference/forms/types/options/pattern.rst.inc +++ b/reference/forms/types/options/pattern.rst.inc @@ -9,7 +9,8 @@ given regular expression. .. caution: The ``pattern`` attribute provides client-side validation for convenience - purposes only and cannot replace a reliable server-side validation. + purposes only and must not be used as a replacement for reliable + server-side validation. .. note: