Update Feature Attributes

Loading...

Note: Support for 3D on mobile devices may vary, view the system requirements for more information.

This sample demonstrates how to use FeatureLayer.applyEdits() to update attributes of existing features. This sample uses the FeatureForm widget to update attributes of existing features by calling the applyEdits function when a user selects a feature on the view.

The form is set up to display grouped field configurations. Having grouped field configurations provides a more manageable editing workflow. This sample uses nested field configurations which autocasts to FieldGroupConfig.

form = new FeatureForm({
  container: "form",
  groupDisplay: "sequential",
  layer: featureLayer,
  // Autocastable to FieldGroupConfig
  // Inspector group
  fieldConfig: [{
    label: "Inspector information",
    description: "Field inspector information"
    // individual field configurations within the group
    fieldConfig: [{
      name: "inspector",
      label: "Name"
      },
      {
        name: "inspemail",
        label: "Email address"
      },
      {
        name: "inspdate",
        label: "Date of inspection"
      }]
    },
    // Contact group field configuration
    {
      label: "Contact information",
      description: "The insured's contact information",
      fieldConfig: [{
        name: "placename",
        label: "Business name"
        },
        {
          name: "firstname",
          label: "First name"
        },
        {
          name: "lastname",
          label: "Last name"
        },
        {
          name: "workphone",
          label: "Work telephone number"
        }]
      },
      // Insurance coverage group
      {
        label: "Insurance coverage"
        description: "Structure and contents coverage",
        fieldConfig: [{
          name: "strinsur",
          label: "Structure insured"
        },
        {
          name: "continsur",
          label: "Contents insured"
        }]
      },
      // Insurance type group
      {
        label: "Insurance type information",description: "Type of insurance coverage",
        fieldConfig: [{
          name: "rentinsur",
          label: "Renter's"
        },
        {
          name: "floodinsur",
          label: "Flood"
        },
        {
          name: "fireinsur",
          label: "Fire"
        }]
      }
    ]
  });

Sample search results

TitleSample
Loading...