Create forms for attribute editing (Map Viewer)

If your map contains editable feature layers (hosted feature layers, hosted feature layer views, hosted table layers, or ArcGIS Server feature layers), you can define forms that editors can use when they update field values for the feature layers in the web map. You can define a form for every editable feature layer in the map, or only those layers that you know the users of the map will need to edit.

When you create a form, you specify what form elements the form contains and how the elements appear. Having a form helps guide editors to the correct fields and allowable attribute values for each editable field.

The form is saved as part of the map. When you share the map, others can use the forms you define to edit the feature layers or table layers in the map.

Note:

Currently, you can configure forms in Map Viewer in ArcGIS Online and ArcGIS Enterprise and in the ArcGIS Field Maps web app.

You can use forms to edit feature layers in Map Viewer in ArcGIS Online and ArcGIS Enterprise and in the ArcGIS Field Maps mobile app.

Before creating a form

Before you create a form for a feature layer in your map, familiarize yourself with the layer's contents and field settings. What a field contains affects whether you create element groups for fields. The settings that are applied to a field, such as whether null values are allowed, whether a default value is defined, and whether the layer owner defined lists for the field, affect how you format the field elements on the form.

Create a form

You can create an input form for each editable feature layer in the map. You define what fields (elements) appear on the form and where they are placed.

When an editor selects a feature in an editable feature layer, the form appears so the editor can input attribute values for that layer.

Follow these steps to create a form for an editable feature layer:

  1. Confirm that you are signed in and that you have privileges to create content.
  2. On the Contents (dark) toolbar, click Layers to open the Layers pane.
  3. Add an editable feature layer to the map.
  4. With the editable feature layer selected, click More on the Settings (light) toolbar and click Forms Forms.

    The Configure form window appears.

  5. Use the following options alone or in combination to add elements to the form.

    Form elements are field groupings and the input fields that appear on the form. Field elements are based on existing fields in the feature layer.

    • Convert the existing pop-up—If you configured pop-ups for the feature layer, you can use the existing pop-up configuration as a starting point to configure the form.
    • Add fields—Choose which fields in the layer to add to the form. When a field is added to the form canvas, it becomes a form element.
    • Create groups of elements—You can create expandable and collapsable group elements to keep logically related information together on the form.
  6. After you add fields and groups as elements to the form canvas, format each element.
  7. Optionally, define Arcade or SQL expressions that define when an element should or should not appear on the form.
  8. When you finish adding, formatting, and configuring conditional expressions for the elements on the form, click OK to create the form.
  9. Save the map.

    Note:

    If you close the map without saving, you lose the form.

If you need to change the form after you create it, repeat the steps above. Be sure to save the map after you edit the form.

Convert the existing pop-up

If the feature layer has pop-ups configured, click Convert pop-up to add fields from the pop-up to the form canvas.

Fields that are not part of the pop-up configuration appear in the Fields list in the Form builder. You can drag them onto the form canvas to add them as elements to the form, as described in the next section.

After you add fields as elements to the form, you can create groups to aggregate related fields or proceed with formatting field elements.

Note:

Fields that contain high-accuracy GPS metadata can only appear on the form if they are imported from an existing pop-up. Because these fields should be populated from GPS devices only, disable editing for the corresponding form elements.

Add fields

Choose which fields in the layer to present to editors as form elements. In most cases, you add fields that the editors will use to update values.

For example, if the feature layer contains the following fields—Site Name, Site Type, Build Status, Landscaping, Edit Date, Editor Name, Creation Date, Creator Name, ID, and Shape—you might place only the Site Name, Site Type, Build Status, and Landscaping fields on the form because the Edit Date, Editor Name, Creation Date, Creator Name, and ID fields are automatically populated, and the Shape field is populated when editors add a feature to the layer.

You can also add fields for reference and disable editing on the form element. In the previous example, you might include the Edit Date field as an uneditable element on the form so the editors can see when the feature was last updated.

  1. Use one of the following methods to add fields as elements to the form:
    • Add all fields to the form—Click Add all in the Fields list to include all the fields in the layer on the form. When you have a lot of editable fields in the layer, adding all the fields and removing one or two system or uneditable fields is faster than adding individual fields.
    • Add a selection of fields to the form—To include a specific selection of fields in the form, press the Ctrl key, click the fields to include, and drag them to the form canvas.
    • Add fields one by one—To add a single field to the form at a time, double-click it or drag it to the form canvas.

    Tip:

    If the layer or table contains a large number of fields, you can use the Find Fields search bar in the Fields list to locate a specific field.

  2. After you add fields as elements to the form, you can create groups (as described in the next section) or proceed with formatting field elements.

Create groups of elements

To group related fields in the same physical location on the form, create a group element. Grouping elements is similar to placing questions in the same section on a paper form. Groups on digital forms have the added advantage that they can be contracted to show only the group heading until the form user expands the group.

For example, on a form to update content in a trails feature layer, create a group for all the fields related to trail properties, such as the trail name, type, and difficulty. You can create a separate group for the fields that record trail maintenance information, such as maintenance crew name, the date maintenance was last performed, and the description of the maintenance performed. If you choose to open the form with groups collapsed, the editors see only the two group names until they expand the groups.

Follow these steps to group related elements together on the form in a collapsable section:

  1. Drag the Group element from the Form Elements list to the form canvas.

    A form element is added to the form canvas.

  2. Drag related fields into the group.

    You can drag fields from the Fields list in the Form builder panel or from the form canvas.

  3. Select the group element to edit its properties.

    The Properties pane appears, allowing you to edit the following information:

    • Display name—Provide a name that describes the fields that are contained in the group. This is similar to a section heading on a paper form. This value is required.
    • Description—Provide a description for the group.
    • Initial state—By default, groups are expanded when the form opens, which means all fields are visible automatically. Uncheck the Expanded check box if you want the initial state of the group to be contracted. Form users will click the group to expand it and see the fields it contains.
    • Conditional visibility—Add an SQL or Arcade attribute expression to apply rules for when the group should appear in the form. See Configure conditional visibility for details.

Tip:

You can remove all form elements from a group by selecting Ungroup from the group toolbar. You can remove multiple elements from the group by pressing Ctrl, selecting each element you want to remove, and dragging them out of the group.

Apply formatting to form elements

When you select a form element on the form canvas, the Properties pane appears.

The previous section described setting properties for group elements.

For field elements, the Formatting section of the Properties pane shows properties that you can define for the element on the form and those that are inherited from the layer and cannot be altered for the form. The following sections describe the properties you can define for field elements on the form.

Define a display name

Every form element requires a value for the Display name. The display name is the label that accompanies the element on the form.

For fields, the default display name is the same as the field name. Accept the default or type a more user-friendly or descriptive display name for each field.

Format text elements

If a form element references a string field, follow these steps to format the element:

  1. Select a text form element to open the Properties pane.
  2. Click the Input type drop-down menu and select one of the options.
    • Barcode—This can be used only in apps that have a bar code reader. If you choose this input type, the element will revert to a single line of text in apps that cannot read bar codes as input, such as Map Viewer.
    • Text - Single line—The input field on the form will show a single line of text.
    • Text - Multiline—The input field on the form will be several lines high. Use this input type for text fields with a high maximum length to allow editors to see all text in the field.
  3. To display text in the field that prompts the editor for the correct value, type that text in the Placeholder field.

    For example, you could type Type the applicant's first name as placeholder text for a field that stores the first name of the person applying for a loan.

    Placeholder text appears inside the input field element, and is replaced by the text the editor provides.

    You cannot set placeholder text for a field that has a default value defined.

  4. In the Description field, provide text that explains what the values in the field represent.

    The description appears below the element on the form.

  5. Set values for Min. length (minimum character length) and Max. length (maximum character length) for the element.

    Sometimes, a feature layer is published with a default text field size rather than a length that makes sense for the field. For example, a field that can have only a finite number of values, such as yes, no, or unknown, might have a field length in the feature layer of 256 characters. But you can set a minimum and maximum of 1 if you want editors to type only y, n, or u when editing values in the field.

    You cannot set a maximum character length that is longer than the field length.

  6. Use the Required drop-down menu to define whether input to the field is required.

    See Define elements as required for more information.

  7. To prevent editors from using the form to update values in this field, uncheck Allow editing.

    For example, you may include a field for reference purposes, but you don't want editors to alter the values in the field.

Format date elements

You can configure date elements to use a date picker or a date and time picker. You can also set a range of acceptable date values by specifying start and end dates.

Follow these steps to format elements that reference date fields:

  1. Select a date form element to open its Properties pane.
  2. Click the Input type drop-down menu and select one of the options.
    • Date—This allows the editor to provide a date.
    • Date and time—This allows the editor to provide a date and time.
  3. In the Description field, provide text that explains what the values in the field represent.

    The description appears below the element on the form.

  4. For date elements, optionally set values for the Start date and End date parameters to restrict a date range that editors can use.

    For example, for a date field in a new layer that records inspections that will be completed in the first quarter of the year, set the start date to the first day of the year and the end date to March 31 for the appropriate year.

  5. For date and time elements, optionally set values for the Start time and End time parameters.

    For example, for forms that are used during business hours only, you can restrict the start and end times so they do not fall outside your business hours.

  6. Use the Required drop-down menu to define whether input to the field is required.

    See Define elements as required for more information.

  7. To prevent editors from using the form to update values in this field, uncheck Allow editing.

    For example, you may include a field for reference purposes, but you don't want editors to alter the values in the field.

Format number elements

If the element uses a feature layer field that is a double or an integer data type, follow these steps to format the form element:

  1. Select a text form element to open the Properties pane.
  2. Click the Input type drop-down menu and select one of the options.
    • Barcode—This can be used only in apps that have a bar code reader. If you choose this input type, the element will revert to the default input type in apps that cannot read bar codes as input, such as Map Viewer.
    • Number - Double—If the field in the layer is defined as a double, the app where the map will be used for editing does not accept a bar code as input, and editors need to input decimal numbers, choose Number - Double.
    • Number - Integer—If the field in the layer is defined as an integer or a double, the app where the map will be used for editing does not accept a bar code as input, and editors should not input decimal numbers, choose Number - Integer.
  3. To display text in the field that prompts the editor for the correct value, type that text in the Placeholder field.

    For example, you could type Type the applicant's first name as placeholder text for a field that stores the first name of the person applying for a loan.

    Placeholder text appears inside the input field element, and is replaced by the text the editor provides.

    You cannot set placeholder text for a field that has a default value defined.

  4. In the Description field, provide text that explains what the values in the field represent.

    The description appears below the element on the form.

  5. Use the Required drop-down menu to define whether input to the field is required.

    See Define elements as required for more information.

  6. To prevent editors from using the form to update values in this field, uncheck Allow editing.

    For example, you may include a field for reference purposes, but you don't want editors to alter the values in the field.

Format an element that contains a list of three or more values

If the field in the feature layer has a list defined for it that contains three or more values, you can configure the form element to appear as a combo box or radio buttons.

  1. Select a form element that references a field with a value list defined to open its Properties pane.
  2. In the Formatting section, click the Input type drop-down menu and select one of the following options:
    • Combobox—Form users choose a value from a list of available options.
    • Radio buttons—All options appear on the form with radio buttons next to them. Form users click the appropriate radio button.

    If the list contains a lot of values (for example, seven or more values), a combo box saves space on the form.

  3. In the Description field, provide text that explains what the values in the field represent.

    The description appears below the element on the form.

  4. Use the Required drop-down menu to define whether input to the field is required.

    See Define elements as required for more information.

  5. To prevent editors from using the form to update values in this field, uncheck Allow editing.

    If the form element is not editable, the radio button or list option setting on the form shows the existing value for the attribute. If you add a feature, no value shows for the combo box or radio button elements unless the field has a default value defined.

Format elements with two possible values

If the field in the feature layer has a list defined for it that contains only two possible values, and the field has a default value set in the layer, you can define that element to appear as a toggle switch on the form, or appear as a combo box or radio buttons.

If the field in the layer does not have a default value set, you can configure the element to appear as a combo box or radio buttons on the form.

  1. Select a form element that references a field with a two-value list defined and a default value defined to open its Properties pane.
  2. In the Formatting section, click the Input type drop-down menu to choose how to present this element:
    • Combobox—Form users choose one of the values from a drop-down list.
    • Radio buttons—The two options appear on the form with radio buttons next to them. Form users click the appropriate radio button.
    • Switch—Form users enable or disable a toggle switch.

      You can change which value equates to an enabled switch by clicking the Switch order of values button next to the switch values.

      If the field does not have a default value set and you choose Switch for the input type, the element displays as a combo box on the form.

  3. In the Description field, provide text that explains what the values in the field represent.

    The description appears below the element on the form.

  4. Use the Required drop-down menu to define whether input to the field is required.

    See Define elements as required for more information.

  5. To prevent editors from using the form to update values in this field, uncheck Allow editing.

    If the form element is not editable, the radio button, list option, or toggle switch setting on the form shows the existing value for the attribute. If you add a feature, no value shows for the combo box or radio button elements. For switch elements, the default setting is displayed on the form.

Define elements as required

To enforce the input of data for a field, you can configure form elements so that they require an entry. For example, if all applications require a submission date, configure the submission date element to be required.

When editors use the form, they see an asterisk next to the fields that require input, and they cannot save their edits until a value is provided.

  1. Click a field form element to open its Properties pane.
  2. Click the Required drop-down menu and select from one of the following options:
    • No—Select this option when the form element does not have to be updated using this form and when the field in the feature layer is optional when other applications are adding or editing data.
    • Yes, do not allow null values—Select this option when editors are required to provide an entry for the field element and when the field in the feature layer is configured as a not nullable field.
    • Yes, allow null values—Select this option when editors are required to provide an entry for the field element, but the field in the feature layer allows null values.

Configure conditional visibility

You can conditionally show or hide form elements based on values added to previous fields. For example, a Building Assessment form includes a field to indicate whether there is water damage. It also includes a group form element containing fields related to water damage. A conditional visibility expression can be applied to the water damage group so it only appears if water damage is indicated in the earlier field. To create a conditional visibility expression, complete the following steps:

  1. Click a field form element to open its Properties pane.
  2. In the Conditional Visibility section, click + Add expression.

    The Edit expression window appears.

  3. Build an expression using one of the following methods:
    • Use the drop-down menus to choose fields, operations, and values to build the expression.
    • Click Launch Arcade editor to write an Arcade expression in the Arcade editor. This is useful for more complex expressions.

    Each expression is defined by one or more conditions. A condition includes a field name, an operator, and potentially, a value. The list of available operators is determined by the type of field (string, number, or date).

    For example, if a water damage group element only needs to appear if water damage was indicated in an earlier field, the following condition can be used to build the expression:

    • Field name—Water damage
    • Operator—is
    • Value—Yes

    Here is what the same expression looks like in Arcade syntax:

    DomainName($feature, "water_damage") == "Yes"
    

    Map Viewer applies the Arcade Constraint profile to evaluate whether a feature meets the criteria defined in the expression. If a value other than Yes is indicated in the water_damage field, the water damage group will not appear in the form.

  4. To apply more than one condition, click Add condition and repeat the previous step.

    Note:

    If you define multiple conditions, choose whether all conditions must be true (Match all conditions) or only one condition must be true (Match at least one condition) for the form element to be displayed.

  5. Click Save.

    The conditional visibility expression is applied to the group or field.

    Now that you saved the expression, you can apply it to any form element by selecting the form element and clicking the expression you created. You can see which elements are using the expression by clicking the number next to the expression in the Properties pane under Conditional Visibility.

You can duplicate, edit, or delete the expression at any time from the Conditional Visibility menu. To edit the expression using Arcade, click Edit (advanced) from this menu.