Rule in element inside of array

Hey,

I wonder if adding a rule to element inside of array is only possible through custom renderers or is there a much simple way to make it work with material renderers? I’ve tried such uiSchema with simple rule

{
    type: 'VerticalLayout',
    elements: [
      {
        type: 'Control',
        scope: '#/properties/simpleTextField',
        label: 'Simple Text Field',
      },
      {
        type: 'Control',
        scope: '#/properties/myArray',
        label: 'My Array',
        options: {
          detail: {
            type: 'VerticalLayout',
            elements: [
              {
                type: 'Control',
                scope: '#/properties/field1',
                label: 'Field 1',
                rule: {
                  effect: 'HIDE',
                  condition: {
                    scope: '#/properties/simpleTextField',
                    schema: {
                      const: '123',
                    },
                  },
                },
              },
              {
                type: 'Control',
                scope: '#/properties/field2',
                label: 'Field 2',
              },
            ],
          },
        },
      },
    ],
  }

It works for whole array when I move rule to array element, but not just for a field inside. Am I missing something or only way to do it are custom renderers?

Thanks in advance and have a nice day :smiley:

Hi @pegu,

The way the rules are implemented currently, you can’t refer to fields outside of the array. If that is something which you would like to support, then you need to implement a custom renderer which is able to resolve these rules.

Generally I would also be open for contributions to JSON Forms which generalize this rule resolving a bit to allow for more complex use cases than the current ones, like resolving outside the array.