Multi-edit
- Home
- Creating forms
- JsonForm
- Multi-edit
Interface for adding and editing of sub-records, using a javascript add/delete interface.
The sub-records are stored on a separate table.
{ "multiedit": { "id": "species", "table": "demo_item_species", "where": [], "single": "Species", "reorder": false,
"items": [
/* various sub-items */
] } }
Properties are as follows:
id
: (string) a prefix used for all the HTML fields for the entries, akin to the $key
parameter for the MultiEdit::display method
table
: (string) the table into which the multiedit records will be saved
link
: (string) the column in table
which links to the parent table. This is optional, as by default it's the singular of the parent table with _id appended, e.g. pages => page_id
where
: (array) additional clauses to be used when fetching the existing records. This can usually be left empty, but it could be used, for example, to not display date-limited records which have already expired.
single
: (string) a human-readable name for a single record, to be shown on the 'add {single}' button
reorder
: (bool) true if the records can be manually ordered by the person filling in the form. The table needs to have a record_order
column for this to have any effect.
post-add-js
: (string) javascript function name to be called whenever an item is added, see also the internal method Multiedit::setPostAddJavaScript
items
: (array) form items such as field
s, heading
s, or html
blocks - just as is used for a tab. Multiedits within multiedits are not supported.