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

No select multiple in backend?

Started by Muut Archive 10 years ago · 3 replies · 450 views
10 years ago

Hi all, i just over a simple issue. I have a custom page type and I want a "select" header element. Its actually working but not correctly saving ... in my raw frontmatter i get:

TXT
authors: Array
YAML
title: Text Beitrag
@extends:
    type: default
    context: blueprints://pages

form:
  fields:
    tabs:
      fields:
        content:
          fields:
            header.authors:
               type: select
               multiple: true
               label: Author(s)
               options:
                  a: A 
                  b: B
                  c: C
                  d: D

Any hints how to resolve this?

10 years ago

Just to be precise: using "multiple:true" does not seem to work properly. Without it, the select element is perfectly working.

10 years ago

Add the validate type:

YAML

            header.authors:
              type: select
              multiple: true
              label: Author(s)
              options:
                a: A
                b: B
                c: C
                d: D
              validate:
                type: array
10 years ago

Hi flaviocopes and thanks for your feedback!

Somenhow its not working as expected ... now the saved frontmatter looks like this:

YAML
authors:
    -
        - a
    -
        - c
    -
        - d

The values are saved as an array array? Is this a bug or a feature? One more little hint how to resolve this issue? Appreciate greatly! Chris

Suggested topics

Topic Participants Replies Views Activity
Archive · by Deleted User, 9 years ago
0 1350 9 years ago
Archive · by Muut Archive, 9 years ago
2 934 9 years ago
Archive · by Muut Archive, 9 years ago
2 4060 9 years ago
Archive · by Muut Archive, 9 years ago
1 2947 9 years ago
Archive · by Muut Archive, 9 years ago
3 1118 9 years ago