General notes on dynamic forms

Flexible

Simple macro language

Extensions

Extension list

Extensions are additional controls which can be embedded in any dynamic form’s content by copying the control’s name in square brackets to a new line in the form structure, with options specified on subsequent lines preceded by the @ symbol. The following shows the syntax and demonstrates addition of a PDF generation button to a page:

[print.pdf]
@format=landscape

[extra_data_entry_controls.person_autocomplete]

A control which provides autocomplete functionality to lookup against the list of people who are users of this website, searching surname, firstname format. By default the value returned by the control is the ID from the users table, but this can be overridden using the @valueField option. The following options are available:

  • @fieldname - required

Here’s an example of the control configuration:

[extra_data_entry_controls.person_autocomplete]
@fieldname=smpAttr:985
@valueField=person_name
@label=Collector
@class=control-width-5
@tooltip=Person who spots the fruitbody.
@lockable=true

[extra_data_entry_controls.associated_occurrence]

A species input control for inputting an associated occurrence’s species name. This results in a 2nd occurrence being created when the form is saved and an occurrence_association record joining the 2. The following options are available:

  • association_type_id - ID of the association type term to tag against the association.
  • copy_attributes - comma separated list of occurrence attribute IDs whose values are to be cloned from the main occurrence to the association.
  • taxon_list_id - ID of the species list to search if not the same as the main list configured for the form.
  • index - if there are multiple associated occurrence controls on the page, then give each a unique number in the index to allow them to function separately.
  • extraParams - parameters to pass through to the taxon_search service for species name lookup.

The following example shows a species input control with a 2nd control for inputting the associated occurrence.

… code-block:

[species]

[extra_data_entry_controls.associated_occurrence]
@label=Associated organism
@taxon_list_id=3
@association_type_id=123
@copy_attributes=4
@fieldname=occurrence:associated_taxa_taxon_list_id
@class=control-width-5
@lockable=true

[misc_extensions.js_has_permission]

[misc_extensions.js_user_field]

[misc_extensions.data_entry_helper_control]

[misc_extensions.breadcrumb]

[misc_extensions.read_only_input_form]

[misc_extensions.set_page_title]

[misc_extensions.enable_tooltips]

[misc_extensions.location_from_url]

[misc_extensions.query_locations_on_map_click]

Add this control to a data entry form to enable detection of locations under a clicked map point. Details of the found locations are then displayed in a div element on the page. The following options are available:

  • id - HTML id attribute for the div which will contain the location details. A unique default will be assigned if not specified.
  • template - HTML to output for each intersecting location. Field value replacement tokens are specified as {{ fieldname }}. The following fields are available:
    • location_id
    • name
    • comment
    • location_type_id
    • location_type
    • centroid_sref
    • centroid_sref_system
  • locationTypeIds - an array of location type IDs to consider when looking for locations which intersect the click point.

[misc_extensions.area_picker]

Adds a drop down box to the page which lists areas on the maps (e.g. a list of countries). When you choose an area in the drop down, the following happens:

  • The map on the page automatically pans and zooms to the chosen area.
  • The spatial reference system control, if present, automatically picks the best system for the chosen map area as defined in the map area data file.
  • If there are multiple graticules on the map, then only the one for the selected area of the map will show, the others are hidden.

The following options can be passed to this control:

  • @areas - Required - pass an array of area names to include in the drop down list. The area names provided must match those defined in the mapAreaData.js file (as described below).
  • @mapDataFile - optionally specify a different file to the default provided one defining the map areas. If you use this option, copy the file mapAreaData.js from the extensions folder to files/indicia/js rename and edit it there.

Other options available are the same as for data_entry_helper::select controls, e.g. use the @label option to define the control’s label.

[misc_extensions.localised_text]

A simple extension that allows text to be inserted into the form which will be passed through the lang::get() function and therefore can be localised into different languages. The following options can be passed to this control:

  • @text - Required - pass the text to localised.