Index.rst 166 KB
Newer Older
Carsten  Rose's avatar
Carsten Rose committed
1
.. ==================================================
2
3
4
5
6
7
8
9
10
11
12
13
.. FOR YOUR INFORMATION
.. --------------------------------------------------
.. -*- coding: utf-8 -*- with BOM.

.. include:: ../Includes.txt


.. _users-manual:

Users manual
============

Carsten  Rose's avatar
Carsten Rose committed
14
The QFQ extension is activated through tt-content records. One or more tt-content records per page are necessary to render
15
*forms*, *reports* (exports) or to perform *delete* and *save* commands submitted by a QFQ form.
16
17


18
Features not implemented yet
19
20
21
----------------------------

* Multi Forms
22
23
24
25

QFQ content element
-------------------

26
QFQ is used by configuring Typo3 content elements. Insert one or more QFQ content elements on a Typo3 page.
27
28
29
30
31
32
33
34
Specify column and language per content record as wished.

The title of the QFQ content element will not be rendered. It's only visible in the backend for orientation.


QFQ Keywords (Bodytext)
^^^^^^^^^^^^^^^^^^^^^^^

35

36
37
38
39
40
41
42
43
 +-------------------+---------------------------------------------------------------------------------+
 | Name              | Explanation                                                                     |
 +===================+=================================================================================+
 | form              | Formname defined in ttcontent record bodytext                                   |
 |                   | * Fix. E.g.: **form = person**                                                  |
 |                   | * by SIP: **form = {{form}}**                                                   |
 |                   | * by SQL: **form = {{SELECT c.form FROM conference AS c WHERE c.id={{a:C}} }}** |
 +-------------------+---------------------------------------------------------------------------------+
44
45
46
 | r                 | recordId. The form will load the record with the specified id                   |
 |                   | * Variants: **r = 123**, by SQL: **r = {{SELECT ...}}**                         |
 |                   | * If not specified, the default is '0'                                          |
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
 +-------------------+---------------------------------------------------------------------------------+
 | <level>.db        | Select a DB. Only necessary if a different than the standard DB should be used. |
 +-------------------+---------------------------------------------------------------------------------+
 | <level>.fbeg      | Start token for every field (=column)                                           |
 +-------------------+---------------------------------------------------------------------------------+
 | <level>.fend      | End token for every field (=column)                                             |
 +-------------------+---------------------------------------------------------------------------------+
 | <level>.head      | Start token for whole <level>                                                   |
 +-------------------+---------------------------------------------------------------------------------+
 | <level>.tail      | End token for whole <level>                                                     |
 +-------------------+---------------------------------------------------------------------------------+
 | <level>.rbeg      | Start token for row.                                                            |
 +-------------------+---------------------------------------------------------------------------------+
 | <level>.rbgd      | Alternating (per row) token                                                     |
 +-------------------+---------------------------------------------------------------------------------+
 | <level>.rend      | End token for row. Will be rendered **before** subsequent levels are processed  |
 +-------------------+---------------------------------------------------------------------------------+
 | <level>.renr      | End token for row. Will be rendered **after** subsequent levels are processed   |
 +-------------------+---------------------------------------------------------------------------------+
 | <level>.rsep      | Seperator token between rows                                                    |
 +-------------------+---------------------------------------------------------------------------------+
 | <level>.fsep      | Seperator token between fields (=columns)                                       |
 +-------------------+---------------------------------------------------------------------------------+
 | <level>.sql       | SQL Query                                                                       |
 +-------------------+---------------------------------------------------------------------------------+
 | <level>.althead   | If <level>.sql is empty, these token will be rendered                           |
 +-------------------+---------------------------------------------------------------------------------+
74
 | debugShowBodyText | If ='1' and config.ini:*showDebugInfo=yes*: shows a tooltip with bodytext       |
75
 +-------------------+---------------------------------------------------------------------------------+
76

77
78
.. _debug:

79
80
81
82
83
Debug
^^^^^

* config.ini: *SHOW_DEBUG_INFO = yes|no|auto*

84
85
86
87
88
89
  * *yes*:

    * Form:

      * For every internal link/button, show tooltips with decoded SIP on mouseover.
      * Shows 'Edit form' (wrench symbol) button on a form.
90

91
    * Report: Will be configured per tt-content record.
92

93
      *debugShowBodyText = 1*
94

95
  * *no*: No debug info.
96

97
  * *auto*: Depending if there is a Typo3 BE session, set internally:
98

99
100
    * *SHOW_DEBUG_INFO = yes*  (BE session exist)
    * *SHOW_DEBUG_INFO = no*   (no BE session)
Carsten  Rose's avatar
Carsten Rose committed
101
102
103
104

Form
----

105
106
* Forms will be created by using the *Form editor* on the Typo3 frontend (HTML form).
* The Formeditor itself consist of two predefined QFQ forms: *form* and *formElement*
107
108
* Every form consist of a) a *Form* record and b) multiple *FormElement* records.
* A form is assigned to a  *table*. Such a table is called the *primary table* for this form.
109
* There are three types of forms which can roughly categorized into:
110

111
  * *Simple* form: the form acts on one record, stored in one table.
112

113
    * The form will create necessary SQL commands for insert, update and delete automatically.
114

115
  * *Advanced* form: the form acts on multiple records, stored in more than one table.
116

117
    * Fields of the primary table acts like a *simple* form, all other fields have to be specified with *addNupdate* records.
118

119
  * *Multi* form: the form acts simultanously on more than one record. All records use the same *FormElements*.
120

121
122
    * The *FormElements* are defined as a regular *simple* / or *advanced* form, plus a SQL Query, which selects and
      iterates over all records. Those records will be loaded at the same time.
Carsten  Rose's avatar
Carsten Rose committed
123

124
.. _variables:
Carsten  Rose's avatar
Carsten Rose committed
125

126
127
Variable (incl. mixed SQL Statement)
------------------------------------
Carsten  Rose's avatar
Carsten Rose committed
128
129

Most fields of a form specification might contain:
130

Carsten  Rose's avatar
Carsten Rose committed
131
132
133
134
135
* ''constants'' (=strings), this is the standard use case.
* ''variables'' retrieved from the stores (see below),
* ''SQL statements'' (limited set of),
* or any combination of the above.

136
* A variable (or SQL) statement is surrounded by curly braces:
Carsten  Rose's avatar
Carsten Rose committed
137

138
  *{{VarName[:<store / prio>[:<sanitize class>[:<escape>]]]}}*
Carsten  Rose's avatar
Carsten Rose committed
139
140
141

* Example:

142
  *{{r}}*
Carsten  Rose's avatar
Carsten Rose committed
143

144
145
146
147
  *{{index:FS}}*

  *{{name:FS:alnumx:s}}*

148
  *{{SELECT name FROM person WHERE id=1234}}*
Carsten  Rose's avatar
Carsten Rose committed
149

150
  *{{SELECT name FROM person WHERE id={{r}} }}*
Carsten  Rose's avatar
Carsten Rose committed
151

152
  *{{SELECT name FROM person WHERE id={{key1:C:alnumx}} }}*
Carsten  Rose's avatar
Carsten Rose committed
153

154
* Leading and trailing spaces inside curly braces are removed.
Carsten  Rose's avatar
Carsten Rose committed
155

156
157
  * *{{ SELECT "Hello World"   }}* acts as *{{SELECT "Hello World"}}*
  * *{{ varname   }}* acts as *{{varname}}*
Carsten  Rose's avatar
Carsten Rose committed
158

159

160
161
* There are several stores, from where to retrieve the value. If a value is not found in one store, the next store is searched,
  until a value is found or there are no more stores available.
162
* If anywhere along the line an empty string is found, this **is** a value: therefore, the search will stop.
Carsten  Rose's avatar
Carsten Rose committed
163
164
165
166
167
* If no value is found, the value is an <empty string>.

URL Parameter
-------------

168
* URL (=GET) Parameter can be used in *forms* and *reports* as variables.
169
170
171
172
173
174
175
176
177
178
179
180
181
182
* If a value violates a parameter sanitize class, the value becomes an empty string.

Escape
------

* Variables used in SQL Statements might cause trouble, if they contain single or double ticks.
* Escaping of single or double is defined by the parameter <escape> (fourth parameter):

  * 's' - single ticks will be escaped.
  * 'd' - double ticks will be escaped.

* It's not possible to escape single and double ticks at the same time.
* Which of them to escape (single or double) depends on the surrounding SQL query.
* Escaping is only necessary inside of SQL queries.
Carsten  Rose's avatar
Carsten Rose committed
183
184
185
186

Sanitize class
--------------

187
188
189
190
191
192
* All values in Store *C* (Client) and store *F* (Form) will be sanitized:
* All :ref:`predefined-variable-names` have a specific default sanitize class. For these variables, it's not necessary
  to specify a sanitize class.
* All other variables (Store: C, F) get by default the sanitize class defined in the corresponding form. If not defined
  the default class is 'digit'.
* A default sanitize class can be overwritten by individual definition: *{{a:C:all}}*
Carsten  Rose's avatar
Carsten Rose committed
193

194
  * **alnumx**: [A-Za-z][0-9]@-_.,;: /()
Carsten  Rose's avatar
Carsten Rose committed
195
  * **digit**: [0-9].-+
196
197
198
199
  * **email**: [a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}
  * **min|max**: only usable in forms. Compares the value against an lower and upper limit (numeric or string).
  * **min|max date**:  only usable in forms. Compares the value against an lower and upper date or datetime.
  * **pattern**:  only usable in forms. Compares the value against a regexp.
200
  * **allbut**: all characters allowed, but not [ ]  { } % & \ #. The used regexp: '^[^\[\]{}%&\\#]+$',
Carsten  Rose's avatar
Carsten Rose committed
201
202
203
204
205
206
  * **all**: no sanitizing


Store / prio
------------

207
208
209
210
211
Only variables that are known in a specified store can be substituted.

 +-----+----------------------------------------------------------------------------------------+----------------------------------------------------------------------------+
 |Name |Description                                                                             | Content                                                                    |
 +=====+========================================================================================+============================================================================+
212
 | F   | :ref:`STORE_FORM`: data not saved in database yet.                                     | All native form elements. Recent values from the Browser.                  |
213
 +-----+----------------------------------------------------------------------------------------+----------------------------------------------------------------------------+
214
215
 | S   | :ref:`STORE_SIP`: Client parameter 's' will indicate the current SIP, which will be    | sip, r (record_id), form                                                   |
 |     | loaded from the SESSION repo to the SIP-Store.                                         |                                                                            |
216
 +-----+----------------------------------------------------------------------------------------+----------------------------------------------------------------------------+
217
 | R   | :ref:`STORE_RECORD`: Record - the current record loaded in the form                    | All columns of the current record from the current table                   |
218
219
220
 +-----+----------------------------------------------------------------------------------------+----------------------------------------------------------------------------+
 | P   | Parent record. E.g.: on multi forms the current record of the outer query              | All columns of the MultiSQL Statement from the table for the current row   |
 +-----+----------------------------------------------------------------------------------------+----------------------------------------------------------------------------+
221
 | D   | Default values column : The *table.column* specified *default value*.                  |                                                                            |
222
 +-----+----------------------------------------------------------------------------------------+----------------------------------------------------------------------------+
223
 | M   | Column type: The *table.column* specified *type*                                       |                                                                            |
224
 +-----+----------------------------------------------------------------------------------------+----------------------------------------------------------------------------+
225
 | C   | :ref:`STORE_CLIENT`: POST variable, if not found: GET variable                         | Parameter sent from the Client (=Browser).                                 |
226
 +-----+----------------------------------------------------------------------------------------+----------------------------------------------------------------------------+
227
 | T   | :ref:`STORE_TYPO3`: a) Bodytext (ttcontent record), b) Typo3 internal variables        | See Typo3 tt_content record configuration                                  |
228
 +-----+----------------------------------------------------------------------------------------+----------------------------------------------------------------------------+
229
 | V   | :ref:`STORE_VARS`: Generic variables                                                   |                                                                            |
230
 +-----+----------------------------------------------------------------------------------------+----------------------------------------------------------------------------+
231
232
233
234
235
 | 0   | Zero - allways value: 0, might be helpful if a variable is empty or undefined and will | All possible keys                                                          |
 |     | be used in an SQL statement.                                                           |                                                                            |
 +-----+----------------------------------------------------------------------------------------+----------------------------------------------------------------------------+
 | E   | Empty - allways value: 0, might be helpful if a variable is empty or undefined and will| All possible keys                                                          |
 |     | be used in an SQL statement                                                            |                                                                            |
236
 +-----+----------------------------------------------------------------------------------------+----------------------------------------------------------------------------+
237
 | Y   | :ref:`STORE_SYSTEM`: a) Database, b) helper vars for logging/debugging:                |                                                                            |
238
239
 |     | SYSTEM_SQL_RAW ... SYSTEM_FORM_ELEMENT_COLUMN                                          |                                                                            |
 +-----+----------------------------------------------------------------------------------------+----------------------------------------------------------------------------+
Carsten  Rose's avatar
Carsten Rose committed
240

241
* Default *<prio>*: *FSRD* - Form / SIP / Record / Table definition.
Carsten  Rose's avatar
Carsten Rose committed
242
243
* Hint: Preferable, parameter should be submitted by SIP, not by Client (=URL).

244
245
246
  * Warning: Data submitted via 'Client' can be easily spoofed and altered.
  * Best: Data submitted via SIP never leaves the server, cannot be spoofed or altered by the user.
  * SIPs can _only_ be defined by using *Report*. Inside of *Report* use columns 'Link' (with attribute 's'), 'page?' or 'Page?'.
Carsten  Rose's avatar
Carsten Rose committed
247
248
249
250
251
252

.. _predefined-variable-names:

Predefined variable names
-------------------------

253
254
255
256
257
258
259
260
261
262
.. _STORE_FORM:

Store: *FORM* - F
^^^^^^^^^^^^^^^^^

* Represents the values in the form, typically before saving them.
* Used for:

  * Formelements who will be rerendered, after a parent element has been changed by the user.
  * Formelement actions, before saving the form.
Carsten  Rose's avatar
Carsten Rose committed
263
  * Values will be sanitized by the class configured in corresponding the formelement. By default, the sanitize class is `alnumx`.
264

265
266
267
268
269
 +-------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
 | Name                    | Explanation                                                                                                                                |
 +=========================+============================================================================================================================================+
 | FormElement name        | Name of native formelement. To get, exactly and only, the specified form element (for 'p_id'): *{{p_id:F}}*                                |
 +-------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
270
271
272
273
274
275
276
277
278
279
280

.. _STORE_SIP:

Store: *SIP* - S
^^^^^^^^^^^^^^^^

* Filled automatically by creating links. E.g.:

  * in `Report` by using `_page?` or `_link` (with active 's')
  * in `Form` by using subrecords: 'new', 'edit', 'delete' links (system) or by column type `_page?`, `_link`.

281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
 +-------------------------+-----------------------------------------------------------+
 | Name                    | Explanation                                               |
 +=========================+===========================================================+
 | sip                     | 13 char uniqid                                            |
 +-------------------------+-----------------------------------------------------------+
 | r                       | current record id                                         |
 +-------------------------+-----------------------------------------------------------+
 | form                    | current form name                                         |
 +-------------------------+-----------------------------------------------------------+
 | table                   | current table name                                        |
 +-------------------------+-----------------------------------------------------------+
 | urlparam                | all non Typo3 paramter in one string                      |
 +-------------------------+-----------------------------------------------------------+
 | <user defined>          | additional user defined link parameter                    |
 +-------------------------+-----------------------------------------------------------+
296
297
298
299
300
301

.. _STORE_RECORD:

Store: *RECORD* - R
^^^^^^^^^^^^^^^^^^^

302
303
304
305
306
307
308
309
* Current record loaded in Form.
* If r=0, alle values are empty.

 +------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
 | Name                   | Explanation                                                                                                                                |
 +========================+============================================================================================================================================+
 | <column name>          | Name of a column of the primary table (as defined in the current form). To get, exactly and only, the specified form element: *{{p_id:R}}* |
 +------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
310
311
312

.. _STORE_CLIENT:

313
Store: *CLIENT* - C
Carsten  Rose's avatar
Carsten Rose committed
314
315
^^^^^^^^^^^^^^^^^^^

316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
 +-------------------------+------------------------------------------------------------------------------------------------------------------------------------------+
 | Name                    | Explanation                                                                                                                              |
 +=========================+==========================================================================================================================================+
 | s                       | =SIP                                                                                                                                     |
 +-------------------------+------------------------------------------------------------------------------------------------------------------------------------------+
 | r                       | record id. Typically stored in SIP, rarely specified on the URL                                                                          |
 +-------------------------+------------------------------------------------------------------------------------------------------------------------------------------+
 | keySemId                | always current Semester Id                                                                                                               |
 +-------------------------+------------------------------------------------------------------------------------------------------------------------------------------+
 | keySemIdUser            | *{{keySemIdUser}}*, may be changed by user                                                                                               |
 +-------------------------+------------------------------------------------------------------------------------------------------------------------------------------+
 | HTTP_HOST               | current HTTP HOST                                                                                                                        |
 +-------------------------+------------------------------------------------------------------------------------------------------------------------------------------+
 | REMOTE_ADDR             | Client IP address                                                                                                                        |
 +-------------------------+------------------------------------------------------------------------------------------------------------------------------------------+
 | '$_SERVER[*]'           | All other variables accessable by *$_SERVER[]*. Only the often used have a pre-defined sanitize class.                                   |
 +-------------------------+------------------------------------------------------------------------------------------------------------------------------------------+
 | form                    | Unique name of current form                                                                                                              |
 +-------------------------+------------------------------------------------------------------------------------------------------------------------------------------+
 | ANREDE                  | *{{sex}}* == male >> Sehr geehrter Herr, *{{sex}}* == female  Sehr geehrte Frau                                                          |
 +-------------------------+------------------------------------------------------------------------------------------------------------------------------------------+
 | EANREDE                 | *{{sex}}* == male >> Dear Mr., *{{sex}}* == female >> Dear Mrs.                                                                          |
 +-------------------------+------------------------------------------------------------------------------------------------------------------------------------------+
Carsten  Rose's avatar
Carsten Rose committed
339

340
341
.. _STORE_TYPO3:

342
Store: *TYPO3* (Bodytext) - T
Carsten  Rose's avatar
Carsten Rose committed
343
344
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
 +-------------------------+-------------------------------------------------------------------+----------+
 | Name                    | Explanation                                                       | Note     |
 +=========================+===================================================================+==========+
 | form                    | Formname defined in ttcontent record bodytext                     | see note |
 |                         |                                                                   |          |
 |                         | * Fix. E.g. *form = person*                                       |          |
 |                         | * via SIP. E.g. *form = {{form}}*                                 |          |
 +-------------------------+-------------------------------------------------------------------+----------+
 | pageId                  | Record id of current Typo3 page                                   | see note |
 +-------------------------+-------------------------------------------------------------------+----------+
 | pageType                | Current selected page type (typically URL parameter 'type')       | see note |
 +-------------------------+-------------------------------------------------------------------+----------+
 | pageLanguage            | Current selected page language (typically URL parameter 'L')      | see note |
 +-------------------------+-------------------------------------------------------------------+----------+
 | ttcontentUid            | Record id of current Typo3 content element                        | see note |
 +-------------------------+-------------------------------------------------------------------+----------+
 | feUser                  | Logged in Typo3 FE User                                           |          |
 +-------------------------+-------------------------------------------------------------------+----------+
 | feUserUid               | Logged in Typo3 FE User uid                                       |          |
 +-------------------------+-------------------------------------------------------------------+----------+
 | feUserGroup             | FE groups of logged in Typo3 FE User                              |          |
 +-------------------------+-------------------------------------------------------------------+----------+
367
368
369
370
371
372

* **note**: not available
  * in 'dynamicUpdate' or
  * by FormElement class 'action' with type 'beforeSave', 'afterSave', 'beforeDelete', 'afterDelete'.

.. _STORE_VARS:
Carsten  Rose's avatar
Carsten Rose committed
373

374
375
376
Store: *VARS* - V
^^^^^^^^^^^^^^^^^

377
378
379
380
381
382
383
 +-------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
 | Name                    | Explanation                                                                                                                                |
 +=========================+============================================================================================================================================+
 | random                  | random string with length of 32 chars, alphanum                                                                                            |
 +-------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
 | slaveId                 | see FormElement `action`                                                                                                                   |
 +-------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
384

385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428

.. _STORE_SYSTEM:

Store: *SYSTEM* - S
^^^^^^^^^^^^^^^^^^^

 +-------------------------+------------------------------------------------------------+
 | Name                    | Explanation                                                |
 +=========================+============================================================+
 | DB_USER                 | defined in config.ini                                      |
 +-------------------------+------------------------------------------------------------+
 | DB_SERVER               | defined in config.ini                                      |
 +-------------------------+------------------------------------------------------------+
 | DB_NAME                 | defined in config.ini                                      |
 +-------------------------+------------------------------------------------------------+
 | DB_INIT                 | defined in config.ini                                      |
 +-------------------------+------------------------------------------------------------+
 | SQL_LOG                 | defined in config.ini                                      |
 +-------------------------+------------------------------------------------------------+
 | SQL_LOG_MODE            | defined in config.ini                                      |
 +-------------------------+------------------------------------------------------------+
 | SHOW_DEBUG_INFO         | defined in config.ini                                      |
 +-------------------------+------------------------------------------------------------+
 | CSS_LINK_CLASS_INTERNAL | defined in config.ini                                      |
 +-------------------------+------------------------------------------------------------+
 | CSS_LINK_CLASS_EXTERNAL | defined in config.ini                                      |
 +-------------------------+------------------------------------------------------------+
 | CSS_CLASS_QFQ_CONTAINER | defined in config.ini                                      |
 +-------------------------+------------------------------------------------------------+
 | EXT_PATH                | computed during runtime                                    |
 +-------------------------+------------------------------------------------------------+
 | SITE_PATH               | computed during runtime                                    |
 +-------------------------+------------------------------------------------------------+
 | DATE_FORMAT             | defined in config.ini                                      |
 +-------------------------+------------------------------------------------------------+
 | sqlFinal                | computed during runtime, used for error reporting          |
 +-------------------------+------------------------------------------------------------+
 | sqlParamArray           | computed during runtime, used for error reporting          |
 +-------------------------+------------------------------------------------------------+
 | sqlCount                | computed during runtime, used for error reporting          |
 +-------------------------+------------------------------------------------------------+

SQL Statement
-------------
Carsten  Rose's avatar
Carsten Rose committed
429

430
* The detection of an SQL command is case *insensitive*.
431
* Leading  whitespace will be skipped.
432
* The following commands are interpreted as SQL commands:
Carsten  Rose's avatar
Carsten Rose committed
433

434
  * SELECT
435
436
  * INSERT, UPDATE, DELETE, REPLACE, TRUNCATE
  * SHOW, DESCRIBE, EXPLAIN, SET
Carsten  Rose's avatar
Carsten Rose committed
437

438
* A SQL Statement might contain parameters, including additional SQL statements. Inner SQL queries will be executed first.
Carsten  Rose's avatar
Carsten Rose committed
439
* All variables will be substituted one by one from inner to outer.
440
* Maximum recursion depth: 5 (a recursion depth of 2 is sometimes used for mailing with templates, 3 and more probably confuses too much and is therefore not practicable, but supported until depth of 5)
Carsten  Rose's avatar
Carsten Rose committed
441
* The number of variables inside an input field or a SQL statement is not limited.
442
* A resultset of a SQL statement will be imploded over all: concat all columns of a row, concat all rows - there is no glue string.
Carsten  Rose's avatar
Carsten Rose committed
443

444
* Example::
Carsten  Rose's avatar
Carsten Rose committed
445

446
  {{SELECT id, name FROM Person}}
447
448
  {{SELECT id, name, IF({{feUser}}=0,'Yes','No')  FROM Vorlesung WHERE sem_id={{keySemId:Y}} }}
  {{SELECT id, city FROM Address AS adr WHERE adr.p_id={{SELECT id FROM Account AS acc WHERE acc.name={{feUser}} }} }}
449

450
* Special case for SELECT input fields. To deliver a result array specify an '!' before the SELECT: ::
451

452
   *{{!SELECT ...}}*
453

454
  * This is only possible for the outermost SELECT.
455
456
457

Form: basic setup
-----------------
Carsten  Rose's avatar
Carsten Rose committed
458
459

+------------------------+----------------------------------------------------------+-----------------------------------------------------------------------------------------+
460
| Name                   | Type                                                     | Description                                                                             |
Carsten  Rose's avatar
Carsten Rose committed
461
462
463
464
465
+========================+==========================================================+=========================================================================================+
|id                      | int, autoincrement                                       | created by by MySQL                                                                     |
+------------------------+----------------------------------------------------------+-----------------------------------------------------------------------------------------+
|name                    | string                                                   | unique and speaking name of the form. Form will be identified by this name              |
+------------------------+----------------------------------------------------------+-----------------------------------------------------------------------------------------+
466
|title                   | string                                                   | Title, shown on/above the form.                                                         |
Carsten  Rose's avatar
Carsten Rose committed
467
468
469
470
471
472
473
474
475
476
477
+------------------------+----------------------------------------------------------+-----------------------------------------------------------------------------------------+
|noteInternal            | textarea                                                 | Internal notes: special functionality, used variables, ...                              |
+------------------------+----------------------------------------------------------+-----------------------------------------------------------------------------------------+
|tableName               | string                                                   | Primay table of the form                                                                |
+------------------------+----------------------------------------------------------+-----------------------------------------------------------------------------------------+
|permitNew               | enum('sip', 'logged_in', 'logged_out', 'always', 'never')| Default: sip                                                                            |
+------------------------+----------------------------------------------------------+-----------------------------------------------------------------------------------------+
|permitEdit              | enum('sip', 'logged_in', 'logged_out', 'always', 'never')| Default: sip                                                                            |
+------------------------+----------------------------------------------------------+-----------------------------------------------------------------------------------------+
|render                  | enum('plain','table', 'bootstrap')                       | Default bootstrap                                                                       |
+------------------------+----------------------------------------------------------+-----------------------------------------------------------------------------------------+
478
479
480
481
|requiredParameter       | string                                                   | Name of required SIP parameter, seperated by comma. '#' as comment delimiter            |
+------------------------+----------------------------------------------------------+-----------------------------------------------------------------------------------------+
|showButton              | set('new', 'delete', 'close', 'save')                    | Default 'new,delete,close,save'. Shown buttons in the upper right corner of the form.   |
+------------------------+----------------------------------------------------------+-----------------------------------------------------------------------------------------+
Carsten  Rose's avatar
Carsten Rose committed
482
483
|multiMode               | enum('none','horizontal','vertical')                     | Default 'none'                                                                          |
+------------------------+----------------------------------------------------------+-----------------------------------------------------------------------------------------+
484
|multiSql                | text                                                     | Optional. SQL Query which selects all records to edit.                                  |
Carsten  Rose's avatar
Carsten Rose committed
485
486
487
488
489
490
491
492
493
+------------------------+----------------------------------------------------------+-----------------------------------------------------------------------------------------+
|multiDetailForm         | string                                                   | Optional. Form to open, if a record is selected to edit (double click on record line)   |
+------------------------+----------------------------------------------------------+-----------------------------------------------------------------------------------------+
|multiDetailFormParameter| string                                                   | Optional. Translated Parameter submitted to detailform (like subrecord parameter)       |
+------------------------+----------------------------------------------------------+-----------------------------------------------------------------------------------------+
|forwardMode             | string: 'auto|no|page'.                                  |                                                                                         |
+------------------------+----------------------------------------------------------+-----------------------------------------------------------------------------------------+
|forwardPage             | string / query                                           | If $forward=="page": page to jump to                                                    |
+------------------------+----------------------------------------------------------+-----------------------------------------------------------------------------------------+
494
495
496
|bsLabelColumns          | string                                                   | The bootstrap grid system is based on 12 columns. The sum of *bsLabelColumns*,          |
+------------------------+----------------------------------------------------------+ *bsInputColumns* and *bsNoteColumns* should be 12. These values here are the base values|
|bsInputColumns          | string                                                   | for all formelements. Exceptions per formelement can be specified per formelement.      |
Carsten  Rose's avatar
Carsten Rose committed
497
498
499
+------------------------+----------------------------------------------------------+-----------------------------------------------------------------------------------------+
|bsNoteColumns           | string                                                   | note: default number of 'bootstrap 12grid' columns                                      |
+------------------------+----------------------------------------------------------+-----------------------------------------------------------------------------------------+
500
|parameter               | text                                                     | Misc additional parameters. See :ref:`form-parameter`                                   |
Carsten  Rose's avatar
Carsten Rose committed
501
502
503
+------------------------+----------------------------------------------------------+-----------------------------------------------------------------------------------------+
|deleted                 | string                                                   | 'yes'|'no'.                                                                             |
+------------------------+----------------------------------------------------------+-----------------------------------------------------------------------------------------+
504
|modified                | timestamp                                                | updated automatically through stored procedure                                          |
Carsten  Rose's avatar
Carsten Rose committed
505
506
507
508
+------------------------+----------------------------------------------------------+-----------------------------------------------------------------------------------------+
|created                 | datetime                                                 | set once through QFQ                                                                    |
+------------------------+----------------------------------------------------------+-----------------------------------------------------------------------------------------+

509
510
511
512
513
514
515
516
517
518
Field: Form.showButton
^^^^^^^^^^^^^^^^^^^^^^

Display or hide the button 'new' and / or 'delete'.

* *new*: Creates a new record. If the form needs any special parameter via SIP or Client, hide this 'new' button - the necessary parameter are not provided.
* *delete*: The simple form of deleting a record only deletes the record itself, not any child records.



519
.. _form-parameter:
Carsten  Rose's avatar
Carsten Rose committed
520

521
522
Field: Form.parameter
^^^^^^^^^^^^^^^^^^^^^
Carsten  Rose's avatar
Carsten Rose committed
523

524
* The following parameter are optional and can be configured in the *Form.parameter* field.
Carsten  Rose's avatar
Carsten Rose committed
525
526
527
528
529
530
531
532
533

+------------------------+--------+---------------------------------------------------------------------------------------------------+
| Name                   | Type   | Description                                                                                       |
+========================+========+===================================================================================================+
| maxVisiblePill         | int    | Show pills upto <maxVisiblePill> as button, all further in a dropdown menu. Eg.: maxVisiblePill=3 |
+------------------------+--------+---------------------------------------------------------------------------------------------------+
| class                  | string | HTML div with given class, surrounding the whole form. Eg.: class=container-fluid                 |
+------------------------+--------+---------------------------------------------------------------------------------------------------+

534
535
* Example:

536
537
  * maxVisiblePill = 5
  * class = container-fluid
538
539
540
541
542
543

FormElements
------------
* Each *form* contains one or more *FormElement*.
* The *FormElements* are divided in three categories:
  
544
545
546
  * :ref:`class-container`
  * :ref:`class-native`
  * :ref:`class-action`
Carsten  Rose's avatar
Carsten Rose committed
547

548
* Ordering and grouping: Native Form-Elements and Container-Elements (both with feIdContainer=0) will be ordered by 'ord'.
Carsten  Rose's avatar
Carsten Rose committed
549
550
* Inside of a container, all nested elements will be displayed.

551
552
.. _class-container:

Carsten  Rose's avatar
Carsten Rose committed
553
554
555
Class: Container
----------------

556
* Pills are containers for 'fieldset' *and* 'native' Form-Elements.
557
* Fieldsets are containers for 'native' Form-Elements
Carsten  Rose's avatar
Carsten Rose committed
558
559
560
561

Type: fieldset
^^^^^^^^^^^^^^

562
* Native Formelements can be assigned to a fieldset.
Carsten  Rose's avatar
Carsten Rose committed
563
564
565
566
567
568
* name: technical name, used as HTML identifier.
* label: Shown title of the fieldset.

Type: pill
^^^^^^^^^^

569
570
571
572
* Pill is synonymous for a tab. A pill looks like a tab.
* Pills are only available with mode render='bootstrap'.
* If there is at least one pill defined, every native Formelement needs to be assigned to a pill or to a fieldset.
* If there is at least one pill defined, every fieldset needs to be assigned to a pill.
Carsten  Rose's avatar
Carsten Rose committed
573
574
575
576
577

* Parameter:

  * FormElement.'''name''': technical name, used as HTML identifier.
  * FormElement.'''label''': Label shown on the corresponding pill button or inside the dropdown menu.
578
  * FormElement.'''type''': *pill*
Carsten  Rose's avatar
Carsten Rose committed
579
  * FormElement.'''feIdContainer''': 0  # Pill's can't be nested.
580
  * Form.'''Parameter''': *maxVisiblePill=<nr>* Number of Pill-Buttons shown. Undefined means unlimited. Excess Pill buttons will be displayed as a dropdown menu.
Carsten  Rose's avatar
Carsten Rose committed
581

582
583
.. _class-native:

Carsten  Rose's avatar
Carsten Rose committed
584
585
586
Class: Native
-------------

587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
+---------------+-----------------------------+---------------------------------------------------------------------------------------------------+
| Name          | Type                        | Description                                                                                       |
+===============+=============================+===================================================================================================+
| id            | int                         |                                                                                                   |
+---------------+-----------------------------+---------------------------------------------------------------------------------------------------+
| formId        | int                         |                                                                                                   |
+---------------+-----------------------------+---------------------------------------------------------------------------------------------------+
|feIdContainer  | int                         |                                                                                                   |
+---------------+-----------------------------+---------------------------------------------------------------------------------------------------+
|enabled        | enum('yes'|'no')            |                                                                                                   |
+---------------+-----------------------------+---------------------------------------------------------------------------------------------------+
|dynamicUpdate  | enum('yes'|'no')            | In the browser, formelements with "dynamicUpdate='yes'"  will be updated depending on user input. |
|               |                             | :ref:`dynamic-update`                                                                             |
+---------------+-----------------------------+---------------------------------------------------------------------------------------------------+
|name           | string                      |                                                                                                   |
+---------------+-----------------------------+---------------------------------------------------------------------------------------------------+
|label          | string                      | Label of formelement. Depending on layout model, left or on top of the formelement                |
+---------------+-----------------------------+---------------------------------------------------------------------------------------------------+
605
606
607
608
|mode           | enum('show', 'readonly',    | *Show*: regular user input field. This is the default.                                            |
|               | 'required',                 | *Required*: User has to specify a value. Typically, an <empty string> represents 'no value'.      |
|               | 'disabled' )                | *Readonly*: user can't change any data. Data not saved.                                           |
|               |                             | *Disabled*: form element is not visible.                                                          |
609
610
611
612
+---------------+-----------------------------+---------------------------------------------------------------------------------------------------+
|class          | enum('native', 'action',    | Details below.                                                                                    |
|               | 'container')                |                                                                                                   |
+---------------+-----------------------------+---------------------------------------------------------------------------------------------------+
613
|type           | enum('checkbox', 'date', 'time', 'datetime',  'dateJQW', 'datetimeJQW', 'extra', 'gridJQW', 'text', 'editor', 'note',           |
614
|               | 'password', 'radio', 'select', 'subrecord', 'upload', 'fieldset', 'pill', 'beforeLoad', 'beforeSave',                           |
615
|               | 'beforeInsert', 'beforeUpdate', 'beforeDelete', 'afterLoad', 'afterSave', 'afterInsert', 'afterUpdate', 'afterDelete',          |
616
|               | 'sendMail')                                                                                                                     |
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
+---------------+-----------------------------+---------------------------------------------------------------------------------------------------+
|checkType      | enum('min|max', 'pattern',  |                                                                                                   |
|               | 'number', 'email')          |                                                                                                   |
+---------------+-----------------------------+---------------------------------------------------------------------------------------------------+
|checkPattern   | 'regexp'                    |if $check_type=='pattern': pattern to match                                                        |
+---------------+-----------------------------+---------------------------------------------------------------------------------------------------+
|onChange       | string                      |list of 'form element names' of current form, separated by ', ', If one of the named form elements |
|               |                             | change, reload own data / status / mode                                                           |
+---------------+-----------------------------+---------------------------------------------------------------------------------------------------+
|ord            | string                      |display order of form elements ('order' is a reserved keyword)                                     |
+---------------+-----------------------------+---------------------------------------------------------------------------------------------------+
|tabindex       | string                      |HTML tabindex attribute                                                                            |
+---------------+-----------------------------+---------------------------------------------------------------------------------------------------+
|size           | string                      |Visible length of input element. Might be ommited, depending on the choosen form layout.           |
|               |                             |Format: <width>,<height> (in characters)                                                           |
+---------------+-----------------------------+---------------------------------------------------------------------------------------------------+
|bsLabelColumns | string                      | Number of bootstrap grid columns for label. By default empty, value inherits from the form.       |
+---------------+-----------------------------+---------------------------------------------------------------------------------------------------+
|bsInputColumns | string                      | Number of bootstrap grid columns for input. By default empty, value inherits from the form.       |
+---------------+-----------------------------+---------------------------------------------------------------------------------------------------+
|bsNoteColumns  | string                      | Number of bootstrap grid columns for note. By default empty, value inherits from the form.        |
+---------------+-----------------------------+---------------------------------------------------------------------------------------------------+
|maxLength      | string                      |Maximum characters for input.                                                                      |
+---------------+-----------------------------+---------------------------------------------------------------------------------------------------+
|note           | string                      |Note of formelement. Depending on layout model, right or below of the formelement                  |
+---------------+-----------------------------+---------------------------------------------------------------------------------------------------+
|tooltip        | text                        |Display this text as tooltip on mouse over                                                         |
+---------------+-----------------------------+---------------------------------------------------------------------------------------------------+
|placeholder    | string                      |Text, displayed inside the input element in light grey                                             |
+---------------+-----------------------------+---------------------------------------------------------------------------------------------------+
|clientJs       | text                        |Javascript called on 'on change' formelements                                                      |
+---------------+-----------------------------+---------------------------------------------------------------------------------------------------+
|value          | text                        |Default value                                                                                      |
+---------------+-----------------------------+---------------------------------------------------------------------------------------------------+
|sql1           | text                        |SQL query  ('sql' is a reserved keyword)                                                           |
+---------------+-----------------------------+---------------------------------------------------------------------------------------------------+
|sql2           | text                        |second SQL query                                                                                   |
+---------------+-----------------------------+---------------------------------------------------------------------------------------------------+
|parameter      | text                        |might contain misc parameter. Depends on the type of formelement.                                  |
+---------------+-----------------------------+---------------------------------------------------------------------------------------------------+
|feGroup        | string                      | Comma-separated list of Typo3 FE Group ID. NOT SURE IF THIS WILL BE IMPLEMENTED. Native           |
|               |                             | formElements, fieldsets and pills can be assigned to feGroups. Group status: show, hidden,        |
|               |                             | disabled. Group Access: FE-Groups. User will be assigned to FE-Groups and the form defintion      |
|               |                             | reference such FE-groups. Easy way of granting permission.                                        |
+---------------+-----------------------------+---------------------------------------------------------------------------------------------------+
662
|deleted        | string                      | 'yes'|'no'.                                                                                       |
663
664
665
666
667
+---------------+-----------------------------+---------------------------------------------------------------------------------------------------+
|modified       | timestamp                   |updated autmatically through stored procedure                                                      |
+---------------+-----------------------------+---------------------------------------------------------------------------------------------------+
|created        | datetime                    |set once through QFQ                                                                               |
+---------------+-----------------------------+---------------------------------------------------------------------------------------------------+
Carsten  Rose's avatar
Carsten Rose committed
668
669


670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+---------+--------+--------+
| Attribute        | checkbox | dateJQW | datetimeJQW |  gridJQW | extra  | text  | note | password | radio | select | subrecord | timeJQW | upload | editor |
+==================+==========+=========+=============+==========+========+=======+======+==========+=======+========+===========+=========+========+========+
|id                |Internal id                                                                                                                              |
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+---------+--------+--------+
|formId            |Form                                                                                                                            |        |
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+---------+--------+--------+
|containerId       |Assign the Formelement to user defined fieldSet or pill                                                                         |        |
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+---------+--------+--------+
|enabled           |Formelement is active or not                                                                                                    |        |
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+---------+--------+--------+
|name              |Name of a column of the primary table. Formelements with a corresponding table will be saved automatically.                     |        |
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+---------+--------+--------+
|label             |Label shown to the user.                                                                                                        |        |
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+---------+--------+--------+
|mode              |show, readonly, required, lock, disable.                                                                                        |        |
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+---------+--------+--------+
|class             |native                                                                                                                          |        |
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+---------+--------+--------+
|type              | checkbox | dateJQW | datetimeJQW |  gridJQW | extra  | text  | note | password | radio | select | subrecord | timeJQW | upload |        |
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+---------+--------+--------+
|checkType         |          |   -     |   -         |          |        |   -   |      |   -      |       |        |           |   -     |        |   -    |
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+---------+--------+--------+
|checkPattern      |          |   -     |   -         |          |        |   -   |      |   -      |       |        |           |   -     |        |   -    |
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+---------+--------+--------+
|onChange          |   -      |   -     |   -         |          |        |   -   |      |   -      |   -   |   -    |           |   -     |   -    |   -    |
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+---------+--------+--------+
|ord               |   -      |   -     |   -         |   -      |   -    |   -   |   -  |   -      |   -   |   -    |   -       |   -     |   -    |   -    |
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+---------+--------+--------+
|tabindex          |   -      |   -     |   -         |   -      |   -    |   -   |   -  |   -      |   -   |   -    |   -       |   -     |   -    |   -    |
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+---------+--------+--------+
|size              |   -      |         |             |          |        |   -   |      |   -      |   -   |   -  2 |           |   -     |   -  ? |   -    |
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+---------+--------+--------+
|maxLength         |   1      |         |             |          |        |   -   |      |   -      |   - 1 |        |           |         |        |        |
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+---------+--------+--------+
|note              |   -      |   -     |   -         |          |        |   -   |   -  |   -      |   -   |   -    |   -       |   -     |   -    |   -    |
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+---------+--------+--------+
|tooltip           |   -      |   -     |   -         |          |        |   -   |      |   -      |   -   |   -    |           |   -     |   -    |   ?    |
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+---------+--------+--------+
|placeholder       |          |   -     |   -         |          |        |   -   |      |          |       |        |           |   -     |   -    |   -    |
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+---------+--------+--------+
|clientJs          |          |   -     |   -         |   -      |        |   -   |      |   -      |   -   |   -    |           |   -     |   -    |   -    |
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+---------+--------+--------+
|value             |   -      |   -     |   -         |   -      |   -    |   -   |   -  |   -      |   -   |   -    |           |   -     |   -    |   -    |
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+---------+--------+--------+
|sql1              |?                                                                                                                                        |
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+---------+--------+--------+
|Additional attributes in Field 'parameter'. Typically in key=value format.                                                                         |        |
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+---------+--------+--------+
| type             | checkbox | dateJQW | datetimeJQW | gridJQW  | extra  | text  | note | password | radio | select | subrecord | timeJQW | upload | editor |
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+---------+--------+--------+
| accept           |?                                                                                                                                        |
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+---------+--------+--------+
| alt              |?                                                                                                                               |        |
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+---------+--------+--------+
| autocomplete     |          |   -     |   -         |          |        |   -   |      |          |       |        |           |   -     |        |        |
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+---------+--------+--------+
| autofocus        |   -      |   -     |   -         |          |        |   -   |      |   -      |   -   |   -    |           |   -     |   -    |   -    |
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+---------+--------+--------+
| checkBoxMode     |   -      |   -     |             |          |        |       |      |          |       |        |           |         |        |        |
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+---------+--------+--------+
| checked          |   -      |         |             |          |        |   -   |      |          |   -   |        |           |         |        |        |
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+---------+--------+--------+
| unchecked        |   -      |         |             |          |        |   -   |      |          |   -   |        |           |         |        |        |
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+---------+--------+--------+
| label2           |   -      |         |             |          |        |       |      |          |   -   |        |           |         |        |        |
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+---------+--------+--------+
| itemList         |   -      |         |             |          |        |       |      |          |   -   |   -    |           |         |        |        |
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+---------+--------+--------+
| emptyItemAtStart |          |         |             |          |        |       |      |          |       |   -    |           |         |        |        |
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+---------+--------+--------+
| emptyItemAtEnd   |          |         |             |          |        |       |      |          |       |   -    |           |         |        |        |
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+---------+--------+--------+
| emptyHide        |          |         |             |          |        |       |      |          |       |   -    |           |         |        |        |
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+---------+--------+--------+
| accept           |          |         |             |          |        |       |      |          |       |        |           |         |   -  3 |        |
+------------------+----------+---------+-------------+----------+--------+-------+------+----------+-------+--------+-----------+---------+--------+--------+
Carsten  Rose's avatar
Carsten Rose committed
747
748
749
750
751
752
753
754
755
756

* 1: A line break created every <size> elements. Easy way to make checkboxes or radio vertical instead of horizontal.
* 2: Any number >1 makes the 'select' input 'multiple' ready.
* See: https://www.w3.org/TR/html5/forms.html#file-upload-state-(type=file)

* All 'native' Formelements like 'input', 'checkbox', ...

Type: checkbox
^^^^^^^^^^^^^^

757
Checkboxes can be rendered in mode:
Carsten  Rose's avatar
Carsten Rose committed
758

759
* *single*:
Carsten  Rose's avatar
Carsten Rose committed
760

761
  * One column in a table corresponds to one checkbox.
762
  * The value for statuses *checked* and *unchecked* are free to choose.
763
764
  * This mode is selected, if a) *checkBoxMode* = single, or b) *checkBoxMode* is missing **and** the number of fields of the column definition is <3.
  * *parameter*:
Carsten  Rose's avatar
Carsten Rose committed
765

766
767
    * *checkBoxMode* = single (optional)
    * *checked* = <value> (optional, the value which represents 'checked')
Carsten  Rose's avatar
Carsten Rose committed
768

769
      * If *checked* is empty or missing: If *type* = 'enum' or 'set', get first item of the definition. If *type* = string, get default.
Carsten  Rose's avatar
Carsten Rose committed
770

771
    * *unchecked* = <value> (optional, the value which represents 'unchecked')
Carsten  Rose's avatar
Carsten Rose committed
772

773
      * If *unchecked* is empty or missing: If *type* = 'enum' or 'set', get second item of checked. If *type* = 'string', get ''.
Carsten  Rose's avatar
Carsten Rose committed
774

775
    * *label2* = <value>       (Text right beside checkbox) (optional)
Carsten  Rose's avatar
Carsten Rose committed
776
777


778
779
* *multi*:

780
  * One column in a table represents multiple checkboxes. This is typically useful for the column type *set*.
781
782
783
784
785
786
787
788
789
790
  * The value for status *checked* are free to choose, the value for status *unchecked* is always the empty string.
  * Each field key (or the corresponding value from the key/value pair) will be rendered right beside the checkbox.
  * *parameter*

    * *checkBoxMode*: multi
    * *itemList* - E.g.:

      * ``itemList=red,blue,orange``
      * ``itemList=1:red,2:blue,3:orange``
      * ``itemList={{!SELECT id, value FROM someTable}}``
Carsten  Rose's avatar
Carsten Rose committed
791

792
793
794
795
796
  * FormElement '''Maxlength''' - vertical or horizontal alignment:

     * Value: '', 0, 1 - The radios will be aligned vertical.
     * Value: >1 - The readios will be aligned horizontal, with a linebreak every 'value' elements.

Carsten  Rose's avatar
Carsten Rose committed
797
798
799
Type: date
^^^^^^^^^^

800
801
802
* Range datetime: '1000-01-01' to '9999-12-31' or '0000-00-00'. (http://dev.mysql.com/doc/refman/5.5/en/datetime.html)
* Optional:
  * *dateFormat*: ; yyyy-mm-dd | dd.mm.yyyy
803

Carsten  Rose's avatar
Carsten Rose committed
804
Type: datetime
805
^^^^^^^^^^^^^^
Carsten  Rose's avatar
Carsten Rose committed
806

807
808
809
810
811
* Range datetime: '1000-01-01 00:00:00' to '9999-12-31 23:59:59' or '0000-00-00 00:00:00'. (http://dev.mysql.com/doc/refman/5.5/en/datetime.html)
* Optional:
  * *dateFormat*: ; yyyy-mm-dd | dd.mm.yyyy
  * *showSeconds*: 0|1 - shows the seconds. Independent if the user specifies seconds, they are displayed '1' or not '0'.
  * *showZero*: 0|1 - For an empty timestamp, With '0' nothing is displayed. With '1' the string '0000-00-00 00:00:00' is displayed.
812

813
814
Type: extra
^^^^^^^^^^^
815
816
817
* Element is not shown in the browser.
* The element can be used to define / precalculate values for a column, which do not already exist as a native FormElement.
* The element is build /computed on form load.
Carsten  Rose's avatar
Carsten Rose committed
818

819
820
Type: text
^^^^^^^^^^
821

822
* General input for text and number.
Carsten  Rose's avatar
Carsten Rose committed
823
824
825
* size:

  * <number>:  width of input element in characters. Lineheight = 1.
826
  * <cols>,<rows>: input element = textarea, width=<cols>, height=<rows>
Carsten  Rose's avatar
Carsten Rose committed
827

828
829
830
Type: editor
^^^^^^^^^^^^

831
* TinyMCE (https://www.tinymce.com, community edition) is used as the QFQ Rich Text Editor.
832
833
* The content will be saved as HTML inside the database.
* All configuration and plugins will be configured via the 'parameter' field. Just prepend the word 'editor-' in front
834
  of each TinyMCE keyword. Check possible options under https://www.tinymce.com/docs/configure/,
835
836
837
838
839
  https://www.tinymce.com/docs/plugins/, https://www.tinymce.com/docs/advanced/editor-control-identifiers/#toolbarcontrols
* Bars:

  * Top: *menubar* - by default hidden.
  * Top: *toolbar* - by default visible.
840
841
  * Bottom: *statusbar* - by default hidden, exception: *min_height* and *max_height* are given via size parameter.

842
843
844

* The default setting is::

845
846
    editor-plugins=code link searchreplace table textcolor textpattern visualchars
    editor-toolbar=code searchreplace undo redo | styleselect link table | fontselect fontsizeselect | bullist numlist outdent indent | forecolor backcolor bold italic editor-menubar=false
847
848
849
850
    editor-statusbar=false

* size:

851
  * <min_height>,<max_height>: in pixels, including top and bottom bars. E.g.: 300,600
852
853


Carsten  Rose's avatar
Carsten Rose committed
854
Type: note
855
^^^^^^^^^^
Carsten  Rose's avatar
Carsten Rose committed
856
857

Type: radio
858
^^^^^^^^^^^
Carsten  Rose's avatar
Carsten Rose committed
859

860
* Radio Buttons will be built from one of three sources:
Carsten  Rose's avatar
Carsten Rose committed
861

862
  * a) 'sql1': E.g. *{{!SELECT type AS label FROM car }}* or *{{!SELECT type AS label, typeNr AS id FROM car}}* or *{{!SHOW tables}}*.
Carsten  Rose's avatar
Carsten Rose committed
863
864
865

    * Resultset format 'named': column 'label' and optional a column 'id'.
    * Resultset format 'index':
866
867
868

      * One column in resultset >> first column represents *label*
      * Two or more columns in resultset >> first column represents *id* and second column represents *label*.
Carsten  Rose's avatar
Carsten Rose committed
869
870
871

  * b) FormElement.'''parameter''':

872
    * '''itemList''' attribute. E.g.: *itemList=red,blue,orange* or *itemList=1:red,2:blue:3:orange*
Carsten  Rose's avatar
Carsten Rose committed
873

874
  * c) Definition of the *enum* or *set* field (only labels, no ids are possible).
Carsten  Rose's avatar
Carsten Rose committed
875

876
* FormElement '''Maxlength''' - *vertical* or *horizontal* alignment:
877

878
879
   * Value: '', 0, 1 - The radios will be aligned vertical.
   * Value: >1 - The readios will be aligned horizontal, with a linebreak every 'value' elements.
880

Carsten  Rose's avatar
Carsten Rose committed
881
882
883
884
* FormElement.'''parameter''':

  * '''emptyItemAtStart''': Existence of this item inserts an empty entry at the beginning of the selectlist.
  * '''emptyItemAtEnd''': Existence of this item inserts an empty entry at the end of the selectlist.
885
886
  * '''emptyHide''': Existence of this item hides the empty entry. This is usefull for e.g. Enums, which have a en empty
    entry and the empty value should not be an option to be selected.
Carsten  Rose's avatar
Carsten Rose committed
887
888

Type: select
889
^^^^^^^^^^^^
Carsten  Rose's avatar
Carsten Rose committed
890

891
* Select lists will be built from one of three sources:
Carsten  Rose's avatar
Carsten Rose committed
892

893
  * a) 'sql1': E.g. *{{!SELECT type AS label FROM car }}* or *{{!SELECT type AS label, typeNr AS id FROM car}}* or *{{!SHOW tables}}*.
Carsten  Rose's avatar
Carsten Rose committed
894
895
896
897

    * Resultset format 'named': column 'label' and optional a column 'id'.
    * Resultset format 'index':

898
899
      * One column in resultset >> first column represents *label*
      * Two or more columns in resultset >> first column represents *id* and second column represents *label*.
Carsten  Rose's avatar
Carsten Rose committed
900
901
902

  * b) FormElement.'''parameter''':

903
    * '''itemList''' attribute. E.g.: *itemList=red,blue,orange* or *itemList=1:red,2:blue:3:orange*
Carsten  Rose's avatar
Carsten Rose committed
904

905
  * c) Definition of the *enum* or *set* field (only labels, no ids are possible).
Carsten  Rose's avatar
Carsten Rose committed
906
907
908
909

* FormElement.'''size''':

  * <empty>|0|1: Dropdown list.
910
  * >1: Select field with 'size' rows height. Multiple selection of items is possible.
Carsten  Rose's avatar
Carsten Rose committed
911
912
913
914
915

* FormElement.'''parameter''':

  * '''emptyItemAtStart''': Existence of this item inserts an empty entry at the beginning of the selectlist.
  * '''emptyItemAtEnd''': Existence of this item inserts an empty entry at the end of the selectlist.
916
917
  * '''emptyHide''': Existence of this item hides the empty entry. This is usefull for e.g. Enums, which have a en empty
    entry and the empty value should not be an option to be selected.
Carsten  Rose's avatar
Carsten Rose committed
918
919
920
921

Type: subrecord
^^^^^^^^^^^^^^^

922
923
924
The FormElement type 'subrecord' renders a list of records (so called secondary records), typically to show, edit, delete
or add new records. The list is defined as a SQL query. The number of records shown is not limited. These FormElement
will be rendered inside the form as a HTML table.
Carsten  Rose's avatar
Carsten Rose committed
925

926
927
* *sql1*: SQL query to select records. E.g.::

928
   {{!SELECT a.id AS id, CONCAT(a.street, a.streetnumber) AS a, a.city AS b, a.zip AS c FROM Address AS a}}
929

930
931
  * Notice the **exclamation mark** after '{{' - this is necessary to return an array of elements, instead of a single string.
  * Exactly one column **'id'** has to exist; it specifies the primary record for the target form.
932
    In case the id should not be visible to the user, it has to be named **'_id'**.
933
  * Columnname: *[title=]<title>[|[width=]<number>][|nostrip][|icon][|link][|url][|mailto][|_rowClass][|_rowTitle]*
934
935
936
937
938
939

    * All parameter are position independet.
    * Separate parameter by '|'.
    * *[title=]<text>*: Title of the column. The keyword 'title=' is optional. Columns with a title starting with '_' won't be rendered.
    * *[width=]<number>*: Max. width of chars displayed per cell. The keyword 'width=' is optional. Default max width: 20.
      This setting also affects the title of the column.
940
    * *nostrip*: by default, html tags will be stripped off the cell content before rendering. This protects the table
941
      layout. 'nostrip' deactivates the cleaning to make pure html possible.
942
    * *icon*: the cell value contains the name of an icon in *typo3conf/ext/qfq/Resources/Public/icons*. Empty cell values
943
      will omit an html image tag (=nothing rendered in the cell).
944
945
946
    * *link*: value will be rendered as described under :ref:`column-link`
    * *url*: value will be rendered as a href url.
    * *mailto*: value will be rendered as a href mailto.
947
948
949
950
951
952
953
954
955
    * *_rowClass*

      * The value is a CSS class name(s) which will be rendered in the *<tr class="<_rowClass>">* of the subrecord table.
      * The column itself is hidden to the user.
      * By using Bootstrap, the following predefined classes are available:

        * Text color: *text-muted|text-primary|text-success|text-info|text-warning|text-danger* (http://getbootstrap.com/css/#helper-classes)
        * Row background: *active|success|info|warning|danger* (http://getbootstrap.com/css/#tables-contextual-classes)

956
957
958
959
    * *_rowTitle*

      * Defines the title attribute of a subrecod table row (tooltip).

960
961
962
963
964
965
    * Examples::

         SELECT note1 AS 'Comment', note2 AS 'Comment|50' , note3 AS 'title=Comment|width=100|nostrip', note4 AS '50|Comment',
         'checked.png' AS 'Status|icon', email AS 'mailto', CONCAT(homepage, '|Homepage') AS 'url',
         ELT(status,'info','warning','danger') AS '_rowClass', help AS '_rowTitle' ...

966
967
968
969
970
971
972
973
* *parameter*

  * *form*: Target form, e.g. *form=person*
  * *page*: Target page with detail form. If none specified, use the current page.
  * *title*: Title displayed over the table in the current form.
  * *detail*: Mapping of values from the primary form to the target form (defined via `form=...`).

    * Syntax::
974

975
976
977
978
979
        <source table column name 1|&constant 1>:<target column name 1>[,<source table column name 2|&constant 2>:<target column name 2>][...]

    * Example: *detail=id:personId,&12:xId,&{{a}}:personId*
    * By default, the given value will overwrite values on the target record. In most situations, this is the wished behaviour.
    * Exceptions of the default behaviour have to be defined on the target form in the corresponding formelement in the
980
981
982
983
984
      field *value* by changing the default Store priority definition. E.g. `{{<columnname>:RS0}}` - For existing records,
      the store `R` will provide a value. For new records, store `R` is empty and store S will be searched for a value:
      the value defined in `detail` will be choosen. At last the store '0' is defined as a fallback.
    * *source table column name*: E.g. A person form is opened with person.id=5 (r=5). The definition `detail=id:personId`
      and `form=address` maps person.id to address.personId. On the target record, the column personId becomes '5'.
985
986
    * *Constant '&'*: Indicate a 'constant' value. E.g. `&12:xId` or `{{...}}` (all possibilities, incl. further SELECT
      statements) might be used.
987

Carsten  Rose's avatar
Carsten Rose committed
988
989
990
991
992
993
994

Type: string
^^^^^^^^^^^^

Type: submit
^^^^^^^^^^^^

995
Typically not used. Useful if user wishes an explicit 'Submit' Button.
Carsten  Rose's avatar
Carsten Rose committed
996
997
998
999

Type: time
^^^^^^^^^^

1000
1001
1002
1003
* Range time: '00:00:00' to '23:59:59' or '00:00:00'. (http://dev.mysql.com/doc/refman/5.5/en/datetime.html)
* Optional:
  * *showSeconds*: 0|1 - shows the seconds. Independent if the user specifies seconds, they are displayed '1' or not '0'.
  * *showZero*: 0|1 - For an empty timestamp, With '0' nothing is displayed. With '1' the string '00:00[:00]' is displayed.
1004

Carsten  Rose's avatar
Carsten Rose committed
1005
1006
1007
1008
Type: upload
^^^^^^^^^^^^

* See: https://www.w3.org/TR/html5/forms.html#file-upload-state-(type=file)
1009
* parameter:accept: *image/*,video/*,audio/*,.doc,.docx,.pdf,<mime type>*
Carsten  Rose's avatar
Carsten Rose committed
1010

1011
An upload element is based on a file browse button and a delete button. Only one of them is shown at a time.
Carsten  Rose's avatar
Upload:    
Carsten Rose committed
1012
1013
The file browse button is displayed, if there is no file uploaded already.
The trash button is displayed, if there is file uploaded already.
1014
1015
1016
1017

The user can than select a file from the local filesystem.
After choosing the file, the upload starts immediately, shown by a turning wheel. When the server received the whole file
and accepts the file, the browse button dissappears and the filename is shown, followed by a delete button.
Carsten  Rose's avatar
Upload:    
Carsten Rose committed
1018
Either the user is satisfied now or the user can delete the uploaded file (and maybe upload another one).
1019
Until this point, the file is cached on the server but not copied to the final destination. The user have to save the
Carsten  Rose's avatar
Upload:    
Carsten Rose committed
1020
current record, either to finalize the upload or to delete a previous uploaded file.
1021
1022
1023

* FormElement. *parameter*:

1024
  * *fileDestination*: Destination where to copy the file. A good practice is to specify a relative `fileDestination` - such an
1025
    installation (filesystem and database) are moveable.
1026

1027
    * If `fileDestination` should contain the original filename, the variable *{{_filename}}* can be used. Example ::
1028

1029
        fileDestination={{SELECT 'fileadmin/user/pictures/', p.name, '-{{_filename}}' FROM Person AS p WHERE p.id={{r}} }}
1030

1031
1032
1033
1034
1035
1036
    * If a file already exist under `fileDestination`, an error message is shown and 'save' is aborted.
       The user has no possibility to overwrite the already existing file. If the whole workflow is correct, this situation
       should no arise.

    * All necessary subdirectories in `fileDestination` are automatically created.

Carsten  Rose's avatar
Upload:    
Carsten Rose committed
1037
1038
1039
    * Using the current record id in the `fileDestination`: Using {{r}} is problematic for new records: that one is still '0'
      at the time of saving. Use `{{id:R0}}` instead.

1040
Deleting a record and the referenced file
1041
'''''''''''''''''''''''''''''''''''''''''
1042
1043
1044
1045
1046
1047
1048
1049

If the user deletes a record which contains reference(s) to files, such files are deleted too.

Only columns where the columname contains `pathFileName` are checked for file references. Therefore, always choose a
columnanem which contains `pathFileName`.

If there are other records, which references the same file, such files are not deleted (but the record is deleted).
It's a very basic check: just the current column of the current table is compared.
1050

1051
1052
.. _class-action:

Carsten  Rose's avatar
Carsten Rose committed
1053
1054
1055
Class: Action
-------------

1056
1057
Type: before... | after...
^^^^^^^^^^^^^^^^^^^^^^^^^^
Carsten  Rose's avatar
Carsten Rose committed
1058

1059
Types:
Carsten  Rose's avatar
Carsten Rose committed
1060

1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
  * beforeLoad
  * afterLoad
  * beforeSave
  * afterSave
  * beforeInsert
  * afterInsert
  * beforeUpdate
  * afterUpdate
  * beforeDelete
  * afterDelete
Carsten  Rose's avatar
Carsten Rose committed
1071

1072
* Check data
Carsten  Rose's avatar
Carsten Rose committed
1073

1074
1075
  Perform checks by fireing s SQL query and expecting a predefined number of selected records. Depending on the
  'action'-type, the check is perform on form load, or form save.
Carsten  Rose's avatar
Carsten Rose committed
1076

1077
1078
1079
  * OK: the expected number of records has been selected. Continue processing the next FormElement.
  * Fail: the expected number of records has not been selected (less or more): Display an error message and abort the
    current form load or form save.
Carsten  Rose's avatar
Carsten Rose committed
1080

1081
  FormElement.’‘’parameter’‘’:
Carsten  Rose's avatar
Carsten Rose committed
1082

1083
1084
  * ‘’‘requiredList‘’‘ - List of `native`-FormElements: only if all of those elements are filled, the current
    `action`-FormElement will be processed.
1085
  * ‘’‘sqlValidate’‘’ - query. E.g.: `sqlValidate={{!SELECT id FROM Person AS p WHERE p.name LIKE {{name:F:all}} AND p.firstname LIKE {{firstname:F:all}} }}`
Carsten  Rose's avatar
Carsten Rose committed
1086

1087
    * Pay attention to '{{!...' after the equal sign.
Carsten  Rose's avatar
Carsten Rose committed
1088

1089
1090
1091
  * ‘’‘expectRecords‘’‘ - number of records. E.g.: `expectRecords=0` or `expectRecords=0,1` or `expectRecords={{SELECT COUNT(id) FROM Person}}`
    * Separate multiple valid record numbers by ','. If at least one of those matches, the check will pass successfully.
  * ‘’‘messageFail‘’‘ - Message to show. E.g.: `messageFail=There is already a person called {{firstname:F:all}} {{name:F:all}}`
Carsten  Rose's avatar
Carsten Rose committed
1092

1093
* Insert / Update / Delete records
Carsten  Rose's avatar
Carsten Rose committed
1094

1095
  * Save values of a form to different record(s), optionally on different table(s).
1096
  * Typically usefull on 'afterSave' - be carefull when using it earlier, e.g. beforeLoad.
1097
1098
1099
1100
1101
1102
1103

  FormElement.’‘’parameter’‘’:

  * ‘’‘requiredList‘’‘ - List of `native`-FormElements: only if all of those elements are filled, the current
    `action`-FormElement will be processed.
  * ‘’‘slaveId‘’‘:

1104
1105
1106
1107
1108
    * If `slaveId` does not exist or is empty (e.g. a defined query has an empty result):

      * If there is a primary table column, with the same name as the current `action`-FormElement: take the value from that column as `slaveId`.
      * If not: treat it as '0'.

1109
1110
    * A value of `0` means the following `sqlInsert` will be fired.
    * A value > `0` means the following `sqlUpdate` will be fired and the `slaveId` specifies which one.
1111
    * Access the `slaveId` by using the variable `{{slaveId:V}}` inside of `sqlUpdate`, `sqlInsert` or `sqlDelete`.
1112
1113
1114
1115

  * ‘’‘sqlUpdate‘’‘ - query. E.g.:  `sqlUpdate={{UPDATE Address SET street = '{{street:F:all}}' WHERE id={{slaveId:V}} LIMIT 1}}`
  * ‘’‘sqlInsert‘’‘ - query. E.g.:  `sqlInsert={{INSERT INTO Address (pId, street) VALUES ( {{id:R}}, '{{street:F:all}}' WHERE id={{slaveId:V}} }}`

1116
  * ‘’‘sqlDelete‘’‘ - query: E.g.:  `sqlDelete={{DELETE FROM Address WHERE id={{slaveId:V}} AND ''='{{city:F:allbut:s}}' LIMIT 1}}`
1117
1118
1119

  * If the `action`-FormElement name exist as a column in the master record: Update that column with the recent slaveId
    (after an INSERT the last_insert_id() acts as the new `slaveId`).
Carsten  Rose's avatar
Carsten Rose committed
1120
1121
1122
1123
1124
1125



Type: sendmail
^^^^^^^^^^^^^^

1126
1127
1128
1129
1130
1131
* Send mail(s) after saving the record.

* FormElement.'''value''': Body of the email.

* FormElement.’‘’parameter’‘’:

1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
  * ‘’‘sendMailTo‘’‘ - Comma-separated list of receiver email addresses. Optional: 'realname <john@doe.com>. If there
    is no recipient email address, no mail will be sent.
  * ‘’‘sendMailCc‘’‘ - Comma-separated list of receiver email addresses. Optional: 'realname <john@doe.com>.
  * ‘’‘sendMailBcc‘’‘ - Comma-separated list of receiver email addresses. Optional: 'realname <john@doe.com>.
  * ‘’‘sendMailFrom‘’‘ - Sender of the email. Optional: 'realname <john@doe.com>'. **Mandatory**.
  * ‘’‘sendMailSubject‘’‘ - Subject of the email.
  * ‘’‘sendMailReplyTo‘’‘ - Reply this email address. Optional: 'realname <john@doe.com>'.
  * ‘’‘sendMailFlagAutoSubmit‘’‘ - **on|off** - If 'on', the mail contains the header 'Auto-Submitted: auto-send' - suppress OoO replies.
  * ‘’‘sendMailGrId‘’‘ - Will be copied to the mailLog record. Helps to setup specific logfile queries.
  * ‘’‘sendMailXId‘’‘ - Will be copied to the mailLog record. Helps to setup specific logfile queries.

* To use values of the submitted form, use the STORE_FORM. E.g. `{{name:F:allbut}}`
* To use the `id` of a new created or already existing one, use the STORE_RECORD. E.g. `{{id:R}}`


Carsten  Rose's avatar
Carsten Rose committed
1147

1148
1149
1150
1151
1152
.. _dynamic-update:

Dynamic Update
--------------

1153
1154
1155
1156
1157
1158
1159
The 'Dynamic Update' feature makes a form more interactive. If a user change a FormElement who is tagged with
'dynamicUpdate', *all* elements who are tagged with 'DynamicUpdate', will be recalculated and rerendered.

The following fields will be recalculated during 'Dynamic Update'
 * 'modeSql' - Possible values: 'show', 'required', 'readonly', 'hidden'
 * 'value'
 * 'parameter.*' - especially 'itemList'
1160

1161
To make a form dynamic:
1162

1163
1164
1165
1166
1167
 * Mark all FormElements with {dynamic update}=enabled, which should send **or** receive a 'do update' signal.
 * Define the receiving FormElements in a way, that they will interpret the recent user change. The form variable of the
   specific sender FormElement `{{<sender element>:F:<sanitize>}}` should be part of one of the above fields to get an
   impact. E.g.:
   ::
1168

1169
    [receiving formElement].parameter: itemList={{ SELECT IF({{carPriceRange:FE:alnumx}}='expensive','Ferrari,Tesla,Jaguar','General Motors,Honda,Seat,Fiat') }}
1170

1171
* Label and Description are not 'Dynamic Update' aware (Feature Request #2081).
Carsten  Rose's avatar
Carsten Rose committed
1172
1173
1174
1175
1176

Report
======


1177
1178
General
-------
Carsten  Rose's avatar
Carsten Rose committed
1179

1180
To display a report on any given TYPO3 page, create a content element of type 'QFQ Element' (plugin) on that page.
Carsten  Rose's avatar
Carsten Rose committed
1181
1182

A simple example
1183
^^^^^^^^^^^^^^^^
Carsten  Rose's avatar
Carsten Rose committed
1184
1185

Assume that the database has a table person with columns first_name and last_name. To create a simple list of all persons, we can do the following:
1186
1187
1188
::

    10.sql = SELECT id AS person_id, CONCAT(first_name, " ", last_name, " ") AS name FROM person
Carsten  Rose's avatar
Carsten Rose committed
1189

1190
10 Stands for a *root level* of the report (see section `Structure`_). 10.sql defines a SQL query for this specific level. When the query is executed it will return a result having one single column name containing first and last name
Carsten  Rose's avatar
Carsten Rose committed
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
separated by a space character.

The HTML output displayed on the page resulting from only this definition could look as follows:
::

    Marc MusterElton JohnSpeedy Gonzales

..



1202
I.e., QFQ will simply output the content of the SQL result row after row for each single level.
Carsten  Rose's avatar
Carsten Rose committed
1203

1204
However, we can modify (wrap) the output by setting the values of various keys for each level: 10.rsep=<br/> for example tells QFQ to seperate the rows of the result by a HTML-line break. The final result in this case is:
Carsten  Rose's avatar
Carsten Rose committed
1205
1206
1207

::

1208
1209
    10.sql = SELECT id AS person_id, CONCAT(first_name, " ", last_name, " ") AS name FROM person
    10.sep = <br />
Carsten  Rose's avatar
Carsten Rose committed
1210

1211
HTML output:
Carsten  Rose's avatar
Carsten Rose committed
1212
1213
::