[TASK] Document 'defaultValue' handling of form
[Packages/TYPO3.CMS.git] / typo3 / sysext / form / Documentation / FAQ / Index.rst
1 .. include:: ../Includes.txt
2
3
4 .. _faq:
5
6 ===
7 FAQ
8 ===
9
10
11 .. _faq-override-frontend-templates:
12
13 How do I override the frontend templates?
14 =========================================
15
16 There are 2 possible ways to override the frontend templates.
17
18
19 Globally extend the fluid search paths
20 --------------------------------------
21
22 Since EXT:form mainly uses YAML as configuration language you need to
23 register your own additional YAML files. Let us assume you are using a
24 sitepackage ``EXT:my_site_package`` which contains your whole frontend
25 integration.
26
27
28 EXT:my_site_package/Configuration/TypoScript/setup.txt
29 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
30
31 First of all, register a new EXT:form configuration for the frontend via
32 TypoScript.
33
34 .. code-block:: typoscript
35
36 plugin.tx_form {
37 settings {
38 yamlConfigurations {
39 # register your own additional configuration
40 # choose a number higher than 30 (below is reserved)
41 100 = EXT:my_site_package/Configuration/Yaml/CustomFormSetup.yaml
42 }
43 }
44 }
45
46
47 EXT:my_site_package/Configuration/Yaml/CustomFormSetup.yaml
48 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
49
50 Next, define the additional fluid template search paths via YAML.
51
52 .. code-block:: yaml
53
54 TYPO3:
55 CMS:
56 Form:
57 prototypes:
58 standard:
59 formElementsDefinition:
60 Form:
61 renderingOptions:
62 templateRootPaths:
63 20: 'EXT:my_site_package/Resources/Private/Form/Frontend/Templates/'
64 partialRootPaths:
65 20: 'EXT:my_site_package/Resources/Private/Form/Frontend/Partials/'
66 layoutRootPaths:
67 20: 'EXT:my_site_package/Resources/Private/Form/Frontend/Layouts/'
68
69 .. note::
70
71 The preview within the form editor (backend module) uses the frontend
72 templates as well. If you want the preview to show your customized
73 templates, register the new paths for the backend module as well.
74
75
76 EXT:my_site_package/ext_typoscript_setup.txt
77 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
78
79 Register your EXT:form configuration for the backend via TypoScript. Read
80 the :ref:`chapter <concepts-configuration-yamlregistration-backend>` to
81 learn why we recommend using the concept behind ``ext_typoscript_setup.txt``.
82
83 .. code-block:: typoscript
84
85 module.tx_form {
86 settings {
87 yamlConfigurations {
88 100 = EXT:my_site_package/Configuration/Yaml/CustomFormSetup.yaml
89 }
90 }
91 }
92
93
94 .. _faq-migrate-from-v7:
95
96 How do I migrate from EXT:form v7?
97 ==================================
98
99 The old form extension (used in TYPO3 v7, which is compatible to TYPO3 v6)
100 was moved into an own extension called ``form_legacy``. This extension can
101 be found within the official `TER <https://typo3.org/extensions/repository/view/form_legacy>`_.
102 When upgrading to TYPO3 v8 an upgrade wizard will tell you if form_legacy is
103 still needed.
104
105
106 .. _faq-frontend-validation:
107
108 Is there a frontend validation?
109 ===============================
110
111 Yes, an HTML 5 based frontend validation is implemented. Nevertheless,
112 there is no JavaScript validation. This has to be integrated manually.
113 Reliable and maintained projects are `Parsley <https://github.com/guillaumepotier/Parsley.js>`_
114 and `jQuery Validation <https://github.com/jquery-validation/jquery-validation>`_.
115
116
117 .. _faq-localize-client-side-validations:
118
119 How do I localize the client side validations in the frontend?
120 ==============================================================
121
122 The displayed validation message is a browser specific text. The output is
123 not generated by TYPO3 and therefore you cannot change it easily.
124 Nevertheless, there is a JavaScript solution for changing the validation
125 message. See `Stack Overflow <http://stackoverflow.com/questions/5272433/html5-form-required-attribute-set-custom-validation-message>`
126 for more information.
127
128
129 .. _faq-date-picker:
130
131 How does the date picker work?
132 ==============================
133
134 EXT:form ships a datepicker form element. To unfold its full potential you
135 should add jquery JavaScript files and jqueryUi JavaScript and CSS files to
136 your frontend.
137
138
139 .. _faq-user-registration:
140
141 Is it possible to build a frontend user registration with EXT:form?
142 ===================================================================
143
144 Possible, yes. But we are not aware of an integration.
145
146
147 .. _faq-export-module:
148
149 Is there some kind of export module for saved forms?
150 ====================================================
151
152 Currently, there are no plans to implement such a feature. There are huge
153 concerns regarding the data privacy when it comes to storing user data in
154 your TYPO3 database permanently.
155
156
157 .. _faq-honeypt-session:
158
159 The honeypot does not work with static site caching. What can I do?
160 ===================================================================
161
162 If you want to use a static site caching - for example using the
163 staticfilecache extension - you should disable the automatic inclusion of the
164 honeypot. Read more ':ref:`here<typo3.cms.form.prototypes.\<prototypeIdentifier>.formelementsdefinition.form.renderingoptions.honeypot.enable>`'.
165
166
167 .. _faq-form-element-default-value:
168
169 How do I set a default value for my form element?
170 =================================================
171
172 Most of the form elements support setting a default value (do not mix this
173 up with the placeholder attribute). For a text field or a textarea, this is
174 quite trivial.
175
176 A little bit more thrilling is the handling for select and multi select form
177 elements. Those special elements support - beside the :yaml:`defaultValue` - a
178 :yaml:`prependOptionValue` setting. The :yaml:`defaultValue` allows you to select a
179 specific option as default. This option will be pre-selected as soon as the
180 form is loaded. In contrast, the :yaml:`prependOptionValue` allows you to define a
181 string which will be shown as the first select-option. If both settings exist,
182 the :yaml:`defaultValue` is prioritized.
183
184 Learn more ':ref:`here<typo3.cms.form.prototypes.\<prototypeIdentifier>.formelementsdefinition.\<formelementtypeidentifier>.defaultValue>`'
185 and see the forge issue `#82422 <https://forge.typo3.org/issues/82422#note-6>`.