Dynamically manipulate an editor using several dependencies

Hello :upside_down_face:
I’ve stumbled over a problem I can’t wrap my head around as a ClientEval statement won’t work mots likely.
I got 2 SelectBoxEditors like this:

#...
  properties:
    reference:
      type: string
      defaultValue: 'ref1'
      ui:
        label: 'properties'
        reloadIfChanged: true
        inspector:
          group: 'somegroup'
          editor: 'Neos.Neos/Inspector/Editors/SelectBoxEditor'
          editorOptions:
            values:
              ref1:
                label: 'dont hide editor'
              ref2:
                label: 'also dont hide editor'
              ref3:
                label: 'disable depending editor under some condition'
              ref4:
                label: 'alos disable depending editor under some condition'
#...
  depending:
    type: string
    defaultValue: 'val1'
    ui:
      label: 'depending'
      inspector:
        group: 'somegroup'
        position: 50
        editor: 'Neos.Neos/Inspector/Editors/SelectBoxEditor'
        editorOptions:
          values:
            val1:
              label: 'the default value'
            val2:
              label: 'some value'
            val3:
              label: 'the value selected if the editor is disabled'
          disabled: false
          allowEmpty: false
#...

The task is now to change the value of the depending editor to “val3” and disable it, if ref2 or ref3 are selected in the reference editor and enable it again if ref1 or ref2 are selected. Additionally there are exceptions to this rule if a parent node has one of 5 ids, when the editor should always stay enabled.
If someone has a solution or a hint for me i would be realy thankfull :innocent:

Welcome @Joshua_Bohlig

The dynamic client-side configuration processing is your friend here.
With ClientEval you can do a lot of client side manipulation of properties.

Please check the docs, especially the example for the hidden configuration of an editor:
https://neos.readthedocs.io/en/4.3/CreatingASite/NodeTypes/DynamicConfigurationProcessing.html#hiding-one-property-when-the-other-one-is-not-set

Hey thank you for the welcome and the quick answer @lubitz :innocent: . I managed to get the ClientEval part down so thank you for the tip. But as always one solution gives 2 more issues ^^.
The problems are with the selectable values, if i change them similar to the hidden configuration.
First i change the values like this:

values: 'ClientEval:( logicExpression ?  {"val1": {"label": "the default value"}, "val2":  ... } : {"val2": {"label": 'some value'}, "val3": {"label": "someothervalue}, ... }

The Problems now are:

  1. If val1 was selected before the logic expression changes I get an invalid value error shown in the Editor as the values now do no longer include val1.

    This problem is probalby easy to solve I just can’t figure out where to change the value of the editor with ClientEval to a valid value once the evaluation changes.

  2. If a value is properly selected and value is applied or the article is published, the editor flips from the the value to the error message in 1. and back to the value.

Here the problem is that the ClientEval expression changes from the boolean evaluation to a string literal of the expression itselve , then back to the evaluation. It does this 2 times before setteling with the evaluation.

Also to not bother you with another post, do you know a way to make more than a binary decision? As far as I understand ClientEval is Limited to onyl 2 outcomes so if a third is required it reaches its limits right?
I would again be glad for some advice :slight_smile:

I never did that with values in that way. What about using two properties?

Each property with it’s own static value list. And depending on the selection in the “root” property, you can hide or show the corresponding “child” property.

Another way might be to use a custom datasource with a parameter (your “root” property selection)
https://docs.neos.io/guide/advanced/extending-neos-with-php-flow/custom-data-sources

While searching a link for you, I found this. Maybe this helps:
https://docs.neos.io/guide/content-repository/nodetype/nodetype-properties#depending-properties