Hello
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
Hey thank you for the welcome and the quick answer @lubitz . 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:
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.
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
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.