Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How can I use a select-field? #547

Closed
peterschoene opened this issue Feb 19, 2024 · 1 comment
Closed

How can I use a select-field? #547

peterschoene opened this issue Feb 19, 2024 · 1 comment

Comments

@peterschoene
Copy link

Hello, I tried to add a new select-field in my femanagerextended.
Here is what I did:
TCA
'my_new_option' => [
'exclude' => false,
'config' => [
'type' => 'select',
'renderType' => 'selectSingle',
'items' => [
['Keine Auswahl', '0'],
['First option 1', 'fo1'],
['Second option 2', 'so2'],
... etc...
],
'size' => 1,
'maxitems' => 1,
'eval' => ''
],
],

Added myNewOption to my model (and database of course)
Added a partial like this:

<femanager:form.select id="femanager_field_mynewoption" property="myNewOption" defaultOption="{f:translate(key:'pleaseChoose')}" class="form-control" additionalAttributes="{femanager:Validation.FormValidationData(settings:settings,fieldName:'myNewOption')}" />

Unfortunately no option appears in FE.
What should I add?
Thank you for your help.

@peterschoene
Copy link
Author

I figured out:

<femanager:form.select
id="femanager_field_my_new_option"
options="{femanagerextended:Form.GetMyNewOption()}"
property="myNewOption"
prependOptionLabel="{f:translate(key:'pleaseChoose')}"
class="form-control"
additionalAttributes="{femanager:Validation.FormValidationData(settings:settings,fieldName:'myNewOption')}" />

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant