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

Button Group with integer keys doesn't display selected state in the CP #10915

Open
eminos opened this issue Oct 8, 2024 · 4 comments · May be fixed by #10916
Open

Button Group with integer keys doesn't display selected state in the CP #10915

eminos opened this issue Oct 8, 2024 · 4 comments · May be fixed by #10916

Comments

@eminos
Copy link

eminos commented Oct 8, 2024

Bug description

When using integers as keys in a Button Group fieldtype it doesn't show the selected state properly in the CP.

How to reproduce

Have a Button Group fieldtype with simple integers (1, 2, 3) as keys.

Logs

No response

Environment

Laravel Version: 11.26.0
PHP Version: 8.3.6

Installation

Fresh statamic/statamic site via CLI

Additional details

No response

@duncanmcclean
Copy link
Member

Are you able to provide the full output of php please support:details?

@eminos
Copy link
Author

eminos commented Oct 8, 2024

Sorry about that. I thought I provided the Statamic version at least, which I assume would be most important in this case, but I didn't. It's Statamic 5.30.0 (latest as of writing).

Anyway I see there's a PR now fixing this issue.

@andjsch
Copy link
Contributor

andjsch commented Oct 10, 2024

Can confirm. I stumbled upon this a few days ago as well!

@andjsch
Copy link
Contributor

andjsch commented Oct 10, 2024

for example this:

tabs:
  main:
    display: Main
    sections:
      -
        fields:
          -
            handle: title
            field:
              type: text
              required: true
              width: 50
              localizable: false
              validate:
                - required
              display: Name
          -
            handle: stars
            field:
              options:
                -
                  key: 1
                  value: '1'
                -
                  key: 2
                  value: '2'
                -
                  key: 3
                  value: '3'
                -
                  key: 4
                  value: '4'
                -
                  key: 5
                  value: '5'
              default: 5
              type: button_group
              display: Sterne
              localizable: false
              width: 50
          -
            handle: quote
            field:
              type: textarea
              display: Quote
              localizable: true
          -
            handle: company
            field:
              type: text
              display: Firma
              localizable: false
              width: 50
              listable: true
              validate:
                - required
          -
            handle: position
            field:
              type: text
              display: Position
              localizable: true
              width: 50
title: Testimonial

As mentioned above, it's only about the selection state that is not displayed correctly. The data saves fine and correctly.

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

Successfully merging a pull request may close this issue.

3 participants