Commit a622bbde authored by Carsten  Rose's avatar Carsten Rose
Browse files

Added Docs to 'delete forms'.

Added FE to FormEditor, to delete FE on Form delete as well.
parent 5ca747f3
......@@ -62,7 +62,7 @@ Preparation for Ubuntu 14.04::
sudo php5enmod mysqlnd
sudo service apache2 restart
Preparation steps for Ubuntu 16.04::
Preparation for Ubuntu 16.04::
sudo apt install php7.0-intl
sudo apt install pdftk libxrender1 file # for file upload, PDF and 'HTML to PDF' (wkhtmltopdf)
......@@ -1340,7 +1340,7 @@ Form
during the installation of new QFQ versions.
* 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.
* There are three types of forms which can roughly categorized into:
* Forms can roughly categorized into:
* *Simple* form: the form acts on one record, stored in one table.
......@@ -1355,6 +1355,8 @@ Form
* 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.
* *Delete* form: any form can be used as a form to `delete-record`_.
* Form mode: The parameter 'r' (given via URL or via SIP) decide if the form is in mode:
* `New`:
......@@ -1491,7 +1493,7 @@ showButton
Display or hide the button `new`, `delete`, `close`, `save`.
* *new*: Creates a new record. If the form needs any special parameter via SIP or Client (=browser), hide this 'new' button - the necessary parameter are not provided.
* *delete*: This either deletes the current record only, or (if defined via action *FormElement* 'before Delete' ) any specified subrecords.
* *delete*: This either deletes the current record only, or (if defined via action *FormElement* 'beforeDelete' ) any specified subrecords.
* *close*: Close the current form. If there are changes, a popup opens and ask to save / close / cancel. The last page from the history will be shown.
* *save*: Save the form.
......@@ -3021,6 +3023,37 @@ form with the following parameter
* sql1: `{{!SELECT i.id AS id, {{basketId:P}} AS basketId FROM Item AS i WHERE i.basketId={{id:P}} }}`
* Parameter: `recordDestinationTable=Item`
.. _delete-record:
Delete Record
-------------
Deleting record(s) via QFQ might be solved by either:
* using the `delete` button on a form on the top right corner.
* by letting `report`_ creating a special link (see below). The link contains the record id and:
* a form name, or
* a table name.
Deleting a record just by specifying a table name, will only delete the defined record (no slave records).
* By using a delete button via `report` or in a `subrecord` row, a ajax request is send.
* By using a delete button on the top right corner of the form, the form will be closed after deleting the record.
Example for report::
SELECT p.name, CONCAT('form=person&r=', p.id) AS _Paged FROM Person AS p
SELECT p.name, CONCAT('table=Person&r=', p.id) AS _Paged FROM Person AS p
To automatically delete slave records, use a form and create `beforeDelete` FormElement(s) on the form:
* class: action
* type: beforeDelete
* parameter: sqlAfter={{DELETE FROM <slaveTable> WHERE <slaveTable>.<masteId>={{id:R}} }}
You might also check the form 'form' how the slave records 'FormElement' will be deleted.
Best practice
-------------
......
......@@ -157,6 +157,8 @@ VALUES
INSERT INTO FormElement (formId, name, label, mode, type, checkType, class, ord, size, maxLength, note, clientJs, value,
sql1, parameter, feIdContainer, subrecordOption, modeSql, placeholder, encode, dynamicUpdate)
VALUES
(1, 'Delete FE', '', 'show', 'beforeDelete', 'all', 'action', 100, 0, 0, '', '', '', '',
'sqlAfter={{DELETE FROM FormElement WHERE formId={{id:R}} }}', 0, '', '', '', 'none', 'no'),
(1, 'name', 'Name', 'required', 'text', 'alnumx', 'native', 120, 0, 0, '', '', '', '', 'autofocus', 1, '', '', '',
'specialchar', 'no'),
(1, 'title', 'Title', 'show', 'text', 'all', 'native', 130, 0, 0, '', '', '', '', '', 1, '', '', '', 'none', 'no'),
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment