getgrav / grav-plugin-form

Grav Form Plugin

Home Page:http://getgrav.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

select option group options don’t take keys

dani-ooo opened this issue · comments

commented

select options don’t work when entering key: value formatting, either as select or select_optgroup fields. i’ve attempted multiple ways, but it doesn’t work.

the following renders the select field without any options:

form.field:
  type: select
  options:
    - select_group:
      option_value: "option key"

and this other option throws an error:

form.field:
  type: select
  options:
    - select_group:
      - option_value: "option key"

An exception has been thrown during the rendering of a template ("Array to string conversion").

i also tried doing it in the selectize structure, getting the same error:

form.field:
  type: select
  options:
    - select_group:
      - text: "option key"
        value: option_value

This is now addressed. Thanks!

@w00fz I am seeing getting an empty field control rendered on this test field:

                options:
                  - OptGroup1:
                    Option1: 'Value!'
                    Option2: 'hey'
                  - OptGroup2:
                    Option3: 'moo'
                    Option4: 'cow'

Using Form 5.1.6.

I can sort of see where the wrong strings are being picked up in the template, but not how to adjust my YAML (which perhaps I shouldn't). Cheers.