Select to view content in your preferred language

FieldElement and visibilityExpression in FeatureForm

468
1
Jump to solution
10-25-2023 06:20 PM
LefterisKoumis
Frequent Contributor

I have two elements  in the FeatureForm widget and I want to hide the second as long the first is blank.  Once something is input in the first element then the second should appear.

This is similar to the Smart Editor functionality in WAB.

I tried this:

 

elements: [{
            // Autocasts to new GroupElement
            type: "group",
            label: "Testing",
            elements: [{ // Autocasts to new FieldElement
              type: "field",
              fieldName: "first",
              label: "First"
            },
            {
              type: "field",
              fieldName: "second",
              label: "Second",
              visibilityExpression: "IIF(!IsEmpty($feature.first))"
            }
            ]
          }, 

 

@JoelBennett ?

 

 

 

 

 

 

 

 

0 Kudos
1 Solution

Accepted Solutions
JoelBennett
MVP Regular Contributor

As seen in the documentation for the visibilityExpression property, you cannot use this property to define your Arcade expression.  Instead, it must reference a value in the expressionInfos collection, which is where your Arcade expression must go.

There's an example nearly identical to what you're trying to do in the Form Constraint section of the Arcade reference page that will probably help.

View solution in original post

0 Kudos
1 Reply
JoelBennett
MVP Regular Contributor

As seen in the documentation for the visibilityExpression property, you cannot use this property to define your Arcade expression.  Instead, it must reference a value in the expressionInfos collection, which is where your Arcade expression must go.

There's an example nearly identical to what you're trying to do in the Form Constraint section of the Arcade reference page that will probably help.

0 Kudos