verbb / formie

The most user-friendly forms plugin for Craft CMS.
Other
93 stars 68 forks source link

Default option (isDefault) for radio buttons and check boxes is not respected by renderForm() #1930

Closed svale closed 1 week ago

svale commented 1 week ago

Describe the bug

I have an issue where I have a form with a set of check boxes and a group of radio buttons and both should be rendered with a default option pre-selected. While this works nicely in the CP preview, I can not get the inputs to have a preset value checked in the frontend templates. I am using craft.formie.renderForm() to render the form.

Steps to reproduce

  1. Create Formie form with either check boxes and/or radio buttons
  2. Mark a single option as "Default" in the fields options table in form field edit view
  3. Render the form in a template using craft.formie.renderForm()

Form settings

Craft CMS version

Craft 5.2

Plugin version

3.0.0-beta.14

Multi-site?

No

Additional context

I have tested this in a local ddev environment and craft cloud, with craft 5.1 and 5.2 and with and without a custom themeConfig passed to the renderForm() method. Hopefully I have just missed some obvious instruction in the docs (but I have really looked...)

svale commented 1 week ago

Actually, I had missed the part in the docs about Populating Forms and craft.formie.populateFormValues()....

engram-design commented 1 week ago

Fixed for the next release. To get this early, run composer require verbb/formie:"dev-craft-5 as 3.0.0-beta.14".

engram-design commented 1 week ago

Fixed in 3.0.0-beta.15