Feature Form
A composable Form toolkit component that enables users to edit field values of features in a layer using a FeatureForm that has been configured externally. Forms may be configured in the Web Map Viewer or Fields Maps Designer) and can be obtained from either an ArcGISFeature
, ArcGISFeatureTable
, FeatureLayer
or SubtypeSublayer
.
The FeatureForm component supports the following FormElement types as part of its configuration.
AttachmentsFormElement
FieldFormElement with the following FormInput types -
BarcodeScannerFormInput
ComboBoxFormInput
DateTimePickerFormInput
RadioButtonsFormInput
SwitchFormInput
TextAreaFormInput
TextBoxFormInput
GroupFormElement
TextFormElement
UtilityAssociationsFormElement
If there are any edits on the current FeatureForm as indicated by FeatureForm.hasEdits and the showFormActions is true, an action bar is displayed at the top of the form with save and discard buttons. The save button will save the edits using FeatureForm.finishEditing and the discard button will discard the edits using FeatureForm.discardEdits. The save or discard actions will also trigger the onEditingEvent callback with the appropriate event type.
If you are providing your own save and discard buttons, be sure to use the FeatureFormState.discardEdits to discard the edits. This will ensure the data and attachments in the form are updated correctly.
The Form is visible as long as it is part of the composition hierarchy. In order to let the user dismiss the Form, the implementation of onDismiss should contain a way to remove the form from the composition hierarchy. If the form has edits when the close icon is clicked, the user will be prompted to save or discard the edits before the callback is invoked. The callback is also not invoked if there are validation errors in the form.
For any elements of input type BarcodeScannerFormInput, a default barcode scanner based on MLKit is provided. The scanner requires the Manifest.permission.CAMERA permission to be granted. A callback is also provided via the onBarcodeButtonClick parameter, which is invoked with the FieldFormElement when its barcode accessory is clicked. This can be used to provide a custom barcode scanning experience. Simply call FieldFormElement.updateValue with the scanned barcode value to update the field value.
For adding any attachments, camera permissions are required. If the permissions are not granted, then the specific functionality is disabled in the form.
If any UtilityAssociationsFormElement is part of the FeatureForm.elements collection, the Form will display UtilityAssociations that are associated with the selected feature and allow the user to navigate to the associated feature on the other end of the association. The Android system's back action can be used to navigate back to the previous FeatureForm screen. The FeatureFormState.activeFeatureForm will be updated when the user navigates forward or back through the associations. If there are any edits on the current FeatureForm, the user will be prompted to save or discard the edits before navigating to the next FeatureForm.
The colors and typography for the Form can use customized using FeatureFormColorScheme and FeatureFormTypography. This customization is built on top of MaterialTheme. If a custom color is specified in both the color scheme and the typography, the color from the color scheme will take precedence and will be merged with the text style, if one is provided.
Since
200.8.0
Parameters
the FeatureFormState object that contains the state of the form.
the modifier to apply to this layout.
Indicates if the close icon should be displayed. If true, the onDismiss callback will be invoked when the close icon is clicked. Default is true.
Indicates if the form actions (save and discard buttons) should be displayed. Default is true.
Indicates if the navigation is enabled for the form when there are UtilityAssociationsFormElements present. When true, the user can navigate to associated features and back. If false, this navigation is disabled. If there are geometry edits on the feature, this flag can be set to false to prevent navigation until the geometry edits are saved or discarded. Default is true.
The ValidationErrorVisibility that determines the behavior of when the validation errors are visible. Default is ValidationErrorVisibility.Automatic which indicates errors are only visible once the respective field gains focus.
A callback that is invoked when the barcode accessory is clicked. The callback is invoked with the FieldFormElement that has the barcode accessory. If null, the default barcode scanner is used.
A callback that is invoked when the close icon is visible and is clicked.
A callback that is invoked when an editing event occurs in the form. This is triggered when the edits are saved or discarded using the save or discard buttons, respectively. If the edit action is triggered by navigating to another form, the willNavigate
parameter will be true. Note that if the action happens due to the close button, the willNavigate
parameter will be false.
The FeatureFormColorScheme to use for the FeatureForm.
The FeatureFormTypography to use for the FeatureForm.
Deprecated
Use the overload that uses the FeatureFormState object. This will become an error in a future release.
A composable Form toolkit component that enables users to edit field values of features in a layer using a FeatureForm that has been configured externally.
The FeatureForm component supports the following FormElement types as part of its configuration.
AttachmentsFormElement
FieldFormElement with the following FormInput types -
BarcodeScannerFormInput
ComboBoxFormInput
DateTimePickerFormInput
RadioButtonsFormInput
SwitchFormInput
TextAreaFormInput
TextBoxFormInput
GroupFormElement
TextFormElement
Since
200.4.0
Parameters
the FeatureForm object to use
the modifier to apply to this layout.
The ValidationErrorVisibility that determines the behavior of when the validation errors are visible. Default is ValidationErrorVisibility.Automatic which indicates errors are only visible once the respective field gains focus.
A callback that is invoked when the barcode accessory is clicked. The callback is invoked with the FieldFormElement that has the barcode accessory. If null, the default barcode scanner is used.
The FeatureFormColorScheme to use for the FeatureForm.
The FeatureFormTypography to use for the FeatureForm.