Skip to content
Grav 2.0 is officially stable. Read the announcement →
Archive

Admin plugin multi select error on save

Started by Muut Archive 10 years ago · 1 replies · 424 views
10 years ago

Hi,
I used the following code in my blueprint to define a multi select field:

YAML
header.headline.classes:
   type: select
   label: Classes
   multiple: true
   options:
      'class1': 'foo'
      'class2' : 'bar'

The field appears correctly, but when I choose some options and try to save the page, I get the following error message:

Array Array Classes

So I changed the code to :

YAML
header.headline.classes:
   type: select
   label: Classes
   multiple: true
   use: keys
   options:
      'class1': foo 
      'class2' : bar
    validate:
       type: commalist

Now the error is gone but the values were saved instead of the keys and the multi select field shows no selected items.

TXT
classes:
   - 'foo,bar'

Am I doing something wrong ?

10 years ago

I think Admin currently does not have the logic to show again, once you saved it, the multiple select choices, so it's not ideal for Admin forms.

You're better served with checkboxes now:

YAML
header.headline.classes:
   type: checkboxes
   label: Classes
   options:
      'class1': 'foo'
      'class2' : 'bar'
   use: keys

Suggested topics

Topic Participants Replies Views Activity
Archive · by Deleted User, 9 years ago
0 1357 9 years ago
Archive · by Muut Archive, 9 years ago
2 936 9 years ago
Archive · by Muut Archive, 9 years ago
2 4066 9 years ago
Archive · by Muut Archive, 9 years ago
1 2954 9 years ago
Archive · by Muut Archive, 9 years ago
3 1120 9 years ago