From 54c6773a85cd152dde1dd8b6c21609a4c68bc35b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Jacob?= <bjoern.jacob@tritum.de> Date: Thu, 17 May 2018 12:58:52 +0200 Subject: [PATCH] [TASK] Document 'defaultValue' handling of form The form framework supports setting a 'defaultValue' for most of the form elements. This patch adds some information about this setting and outlines the difference to the 'prependOptionValue' setting. Resolves: #82422 Releases: master, 8.7 Change-Id: Ic3bbe76ebe69ac0655e11ba501d62ee19b2d143f Reviewed-on: https://review.typo3.org/56991 Reviewed-by: Anja Leichsenring <aleichsenring@ab-softlab.de> Tested-by: Anja Leichsenring <aleichsenring@ab-softlab.de> Tested-by: TYPO3com <no-reply@typo3.com> Reviewed-by: Ralf Zimmermann <ralf.zimmermann@tritum.de> Tested-by: Ralf Zimmermann <ralf.zimmermann@tritum.de> Reviewed-by: Susanne Moog <susanne.moog@typo3.org> Tested-by: Susanne Moog <susanne.moog@typo3.org> --- .../Config/proto/formElements/Index.rst | 26 +++++++++++++++++ typo3/sysext/form/Documentation/FAQ/Index.rst | 28 +++++++++++++++++-- 2 files changed, 51 insertions(+), 3 deletions(-) diff --git a/typo3/sysext/form/Documentation/Config/proto/formElements/Index.rst b/typo3/sysext/form/Documentation/Config/proto/formElements/Index.rst index 1bff152e5f0f..10f9d985e722 100644 --- a/typo3/sysext/form/Documentation/Config/proto/formElements/Index.rst +++ b/typo3/sysext/form/Documentation/Config/proto/formElements/Index.rst @@ -127,6 +127,32 @@ Common <formElementTypeIdentifier> properties ============================================= +.. _typo3.cms.form.prototypes.<prototypeIdentifier>.formelementsdefinition.<formelementtypeidentifier>.defaultValue: + +defaultValue +------------ + +:aspect:`Option path` + TYPO3.CMS.Form.prototypes.<prototypeIdentifier>.formElementsDefinition.<formElementTypeIdentifier>.defaultValue + +:aspect:`Data type` + string/ array + +:aspect:`Needed by` + Frontend/ Backend (form editor) + +:aspect:`Mandatory` + No + +:aspect:`Default value` + undefined + +:aspect:`Description` + If set this string/ array will be used as default value of the form + element. Array is in place for multi value elements (e.g. the + ``MultiSelect`` form element). + + .. _typo3.cms.form.prototypes.<prototypeIdentifier>.formelementsdefinition.<formelementtypeidentifier>.implementationclassname: implementationClassName diff --git a/typo3/sysext/form/Documentation/FAQ/Index.rst b/typo3/sysext/form/Documentation/FAQ/Index.rst index 983f1599a60d..2d2facbe3253 100644 --- a/typo3/sysext/form/Documentation/FAQ/Index.rst +++ b/typo3/sysext/form/Documentation/FAQ/Index.rst @@ -153,11 +153,33 @@ Currently, there are no plans to implement such a feature. There are huge concerns regarding the data privacy when it comes to storing user data in your TYPO3 database permanently. + .. _faq-honeypt-session: The honeypot does not work with static site caching. What can I do? =================================================================== -If you want to use a static site caching - for example using the staticfilecache extension - -you should disable the automatic inclusion of the -honeypot. Read more ':ref:`here<typo3.cms.form.prototypes.\<prototypeIdentifier>.formelementsdefinition.form.renderingoptions.honeypot.enable>`'. \ No newline at end of file +If you want to use a static site caching - for example using the +staticfilecache extension - you should disable the automatic inclusion of the +honeypot. Read more ':ref:`here<typo3.cms.form.prototypes.\<prototypeIdentifier>.formelementsdefinition.form.renderingoptions.honeypot.enable>`'. + + +.. _faq-form-element-default-value: + +How do I set a default value for my form element? +================================================= + +Most of the form elements support setting a default value (do not mix this +up with the placeholder attribute). For a text field or a textarea, this is +quite trivial. + +A little bit more thrilling is the handling for select and multi select form +elements. Those special elements support - beside the :yaml:`defaultValue` - a +:yaml:`prependOptionValue` setting. The :yaml:`defaultValue` allows you to select a +specific option as default. This option will be pre-selected as soon as the +form is loaded. In contrast, the :yaml:`prependOptionValue` allows you to define a +string which will be shown as the first select-option. If both settings exist, +the :yaml:`defaultValue` is prioritized. + +Learn more ':ref:`here<typo3.cms.form.prototypes.\<prototypeIdentifier>.formelementsdefinition.\<formelementtypeidentifier>.defaultValue>`' +and see the forge issue `#82422 <https://forge.typo3.org/issues/82422#note-6>`. \ No newline at end of file -- GitLab