form-builder icon indicating copy to clipboard operation
form-builder copied to clipboard

Can't use variables in properties.options of SingleSelectDropdown

Open marcelhecker opened this issue 2 years ago • 0 comments

I can't use variables or any expression with ${...} in a SingleSelectDropdown. While it works in labels or placeholders, there seems to be a problem with the options array. Only if I set the properties.options like man = 'Man' it works. Am I doing something wrong or is this an issue?

Example 1:

section1 = Neos.Form.Builder:Section.Definition { 
         required = ${false}
         elements {
                        salutation = Neos.Form.Builder:SingleSelectDropdown.Definition {
                            label = ${Translation.translate('Some.Package:NodeTypes.JobFormular:salutation')}
                            properties.options {
                                man = ${Translation.translate('Some.Package:NodeTypes.JobFormular:man')}
                                woman = ${Translation.translate('Some.Package:NodeTypes.JobFormular:woman')}
                                diverse = ${Translation.translate('Some.Package:NodeTypes.JobFormular:diverse')}
                            }
                            required = ${true}
                        }
           }
}

Example 2:

@propTypes {
        @strict = true
        translation = ${PropTypes.string}
    }

translation = 'test'

...

section1 = Neos.Form.Builder:Section.Definition { 
         required = ${false}
         elements {
                        salutation = Neos.Form.Builder:SingleSelectDropdown.Definition {
                            label = ${Translation.translate('Some.Package:NodeTypes.JobFormular:salutation')}
                            properties.options {
                                man = translation
                                woman = ${translation}
                            }
                            required = ${true}
                        }
           }
}

In all variants the following exception is thrown:

An exception was thrown while Neos tried to render your page
$optionValueField must be provided for array $options

root<Neos.Fusion:Case>/ documentType<Neos.Fusion:Matcher>/ element<Some.Package:Document.Job>/ body<Neos.Fusion:Component>/ content<Neos.Fusion:Join>/ main<Neos.Fusion:Component>/ renderer<Neos.Neos:ContentComponent>/ renderer<Neos.Fusion:Array>/ item_3<Another.Package:Molecule.Section>/ content<Neos.Fusion:Array>/ item_2<Some.Package:Meta.JobFormular>/ renderer<Neos.Form.Builder:Form>/

marcelhecker avatar Nov 23 '22 08:11 marcelhecker