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

bugfix: set radio button checked according to form field #445

Conversation

k0va1
Copy link
Contributor

@k0va1 k0va1 commented Sep 9, 2024

No description provided.

@kirillplatonov kirillplatonov merged commit 6a51583 into baoagency:main Sep 9, 2024
4 checks passed
@hirowatari
Copy link
Contributor

Previously this would set the radio button to whatever enabled was.

= render Polaris::ChoiceListComponent.new(form: f, attribute: :enabled, name: :enabled) do |choice|
  = choice.with_radio_button(label: 'Enable', value: true)
  = choice.with_radio_button(label: 'Disable', value: false)

Now checked must also be specified.

= render Polaris::ChoiceListComponent.new(form: f, attribute: :enabled, name: :enabled) do |choice|
  = choice.with_radio_button(label: 'Enable', value: true, checked: f.object.enabled?)
  = choice.with_radio_button(label: 'Disable', value: false, checked: !f.object.enabled?)

Is this intentional? I read through the code for a bit, but thought it would be better to just ask.

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

Successfully merging this pull request may close these issues.

3 participants