Form#

A form (FormComponent) is special type of SegmentComponent that is used for displaying and editing the metadata of an M-Files object as fields, depending on whether you have enabled Controls for your Portal or not. It contains a set of FormComponents

../../../../_images/CtrlPortals-FormsHierarchy.png

The Form and its Component Hierarchy#

FormComponents#

All FieldComponents can contain Fields.

  • AccordionComponent: Represents an accordion UI component. Accordions are commonly used in web and mobile interfaces to display information in a collapsible manner. Here is an example of how the accordion component can be used.

Accordion example

Notice that a PortalRule can be used to determine whether it should be expanded or collapsed by default.

  • Fields: An unorganized set of fields. Fields added to this component are not arranged.

  • Field Column: A single column of fields. Fields added to this column are arranged vertically.

  • Field Row: A row of fields, Fields added to this row are arranged horizontally.

Fields#

A Field represents an M-Files metadata property for the object associated with the M-Files Portal.

Fields can be configured with six different options:

  • Property: The property that the field will display / edit.

  • TextAreaHeight: If the underlying property is a multi-line text property, this option can determine how tall the input text field should be, regardless of the contents of the field. This height is given as lines of text, e.g. if you set this to ‘4’ the input text field will always accommodate at least four rows of text.

  • Required when: A predicate defined from PortalRules used to determine when the field should be required when editing the form. If you set this to e.g. ‘true’ the field is always required, meaning that it needs to hold some value before the changes to the metadata can be saved.

  • Additional when: A predicate defined from PortalRules used to determine whether the field should be displayed as an empty, editable field even if it’s not part of the object’s metadata card.

  • Show when: A predicate defined from PortalRules used to determine when the field should be displayed in the Portal.

  • Read-only: A predicate defined from PortalRules used to determine when the field should be displayed read-only, meaning that it cannot be edited through the portal.

Special Types#

Beyond the default M-Files data types, Portals also support some ‘special types’, which are just a different way of presenting possible values to the users of a Portal.

Radio Buttons#

A radio buttons field is used to present a user with a constrained list of options, it can be used for any of the built-in datatypes. Users are allowed to pick exactly one option.

../../../../_images/2024-04-04-12-37-02.png

You can use radio buttons to present a limited choice for an otherwise infinite range of options, e.g. in this case you can make the user pick between values for a decimal field.#

../../../../_images/2024-04-04-12-38-45.png

This is how you would configure the previously displayed radio buttons (pardon the rounding errors, M-Files Admin rounds values to two decimals automatically).#

Checkbox#

The checkbox type is used like the radio buttons type, to limit selections from a property, but instead of allowing only one value to be selected, it allows multiple values to be selected. The configuration is the same as for radio buttons.

Rating#

The rating type is used to make a prettier and more intuitive interface for a regular ‘number (integer)’ field in M-Files.

../../../../_images/2024-04-05-11-28-21.png

A rating field for a property ‘Satisfaction Score’ using all default values:#

Icon: 'star', Color: 'yellow', Max: 5.

The displayed Icon, Color and maximum amount can be configured.

../../../../_images/2024-04-05-11-32-45.png

A rating field for a property ‘ESG Score’ using different values:#

Icon: 'leaf', Color: 'olive', Max: 5.