The composable FeatureForm in the ArcGIS Maps SDK for Kotlin Toolkit handles processing and display of a feature form. The toolkit component provides UI and logic for editing attributes built from FeatureForm
and its related classes in the ArcGIS Maps SDK for Kotlin API. You will not need to access these classes directly in your code if you use the toolkit component as-is, though you will likely use them if you decide to extend the open-source toolkit.
Form elements
A feature form contains form elements that model the various fields in the feature being edited.
See the description in the toolkit for details and screenshots of the form elements as displayed by the toolkit component.
The four major types of form elements are:
- Field form element - A form element representing a single field. There is one form element for each field defined in the feature form definition. If the layer has no form definition, there is one element for each field.
- Attachments form element - An element containing attachments to the feature. The toolkit component displays a device-native UI for selecting new attachments and naming them. It also allows renaming or deleting existing attachments on the feature.
- Group form element - A set of related form elements that the UI can operate on as a unit. In the toolkit component, a group element can be expanded, collapsed, or displayed/hidden together.
- Text form element - Read-only text in the form.
Field form elements
A field form element exposes the value (number, text, date, barcode) from a feature attribute. To be visible in the form, the read-write visibility
property of the element in the feature form definition must be set to true
.
The allowed input for a form element is specified in the web map's feature form definition. In addition, the feature form takes into consideration the domain and length limit in the layer's data schema and any attributes rules (ArcGIS Server only).
Note the following interactions between the layer's schema in the feature service and the feature form definition:
-
To be edited, the form element must have the
editable
property in the feature form definition and theExpression editable
property for the field in the layer's schema set totrue
. -
If the feature form definition has a
domain
property, it takes precedence over domain definitions for the field, type, or subtype in the layer's schema. -
If the
required
property in the feature form definition is set toExpression true
, the field must have a value. -
Text-based field elements can specify the maximum and minimum number of characters allowed for a text value. If the
max
property is not specified in the feature form definition, the value is determined using theLength Field_Length
property of theField
. If themin
property is not specified, the value is 0, which means there is no minimum constraint.Length
List of field form elements
The following field form elements, defined in the ArcGIS Maps SDK for Kotlin API, are used internally by the toolkit component as needed, based on the feature form definition (or the layer's schema, when there is no form definition).
-
Switch - A binary switch (toggle) for the value of a form field element. It has two options, such as yes or no, true or false, and so on.
-
Radio buttons - A set of values for a form field element. Only one value can be selected at a time. Radio button input is best suited for values that don't have too many options.
-
Combo box - A list of values in a drop-down. Only one value can be selected at a time. In the toolkit component, the user can also enter text to filter the values displayed in the list and then select a value.
-
Text box - A single-line text input.
-
Text area - A multi-line text input for holding larger amounts of text.
-
DateTime picker - A calendar picker with an optional time picker. It applies only to
Field
objects of typeesri
.Field Type Date -
Barcode - Input from a barcode or QR code scanner. A text value can be entered manually if the client doesn't support scanning or if the barcode or QR code cannot be scanned.
A barcode scanner in a mobile device will look something like this during scanning:
And like this in the feature form: