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

Field Select - Default selected option not working #2594

Open
shivamvinsol opened this issue May 23, 2024 · 1 comment
Open

Field Select - Default selected option not working #2594

shivamvinsol opened this issue May 23, 2024 · 1 comment
Labels
bug breakages in functionality that is implemented

Comments

@shivamvinsol
Copy link

Hi, I am using Field::Select and need to show a option as selected by default.
I read the guides and it mentioned that the collection param has the same format as Rails options_for_select

options_for_select does allow selecting a option and I tried the following

collection: [['Apple', 'Ball', 'Cat'], 'Ball']
collection: [{ Apple: 1,  Ball: 2 }, 2]
collection: ['Apple', 'Ball'], selected: 'Ball'

But none of these worked.
Is there a way to do this, or do I need to add a custom field for this?

Thanks and apologies if this issue was raised earlier.

Rails - 7.1.3
Administrate - 0.18

@shivamvinsol shivamvinsol added the bug breakages in functionality that is implemented label May 23, 2024
@Thrizian
Copy link

Thrizian commented Oct 6, 2024

I've made a PR for this issue:

#2676

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug breakages in functionality that is implemented
Projects
None yet
Development

No branches or pull requests

2 participants