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

Community guidelines

Please keep discussions civil and on-topic. Repeated violations may lead to a temporary ban.

Forms & Blueprints

Forms: Fieldset nested within List Problem

admin form

Started by Alex 5 years ago · 0 replies · 676 views
5 years ago

Hi everyone,
what I'm trying to archive is a flexible page content form in admin panel. therefore I nested fieldsets within a list. put some js and css to hide and show fields and so on.
But then I ran into a problem, that values within a given fieldset are hard to reference. If I save the form, values are saved to a md file, but are not referenced/displayed in the form anymore. I also tried some parts of an older post /forum/forms-blueprints/conditional-field-creating-a-flexible-content-field-like-advanced-custom-fields-wordpress-plugin-t1687 but that didn't work either. when form values are saved to md, dot notation gets interpreted as another nesting, therefor form's reference to values doesn't work anymore (see code below).
Hopefully somebody can point me in the right direction or can confirm if this is even possible
thanks!

blueprint (shortened):

YAML
form:
    fields:
        header.news_content:
            type: list
            fields:
                .additional_content_select:
                    type: select
                    options:
                        default: 'none'
                        external: 'external media via iframe'
                        image: 'add an image' 
                .additional_content_pos:
                    type: fieldset
                    fields:
                        .additional_content_pos.pos:
                            type: select
                            options:
                                before: 'before'
                                after: 'after'
                                left: 'on the left'
                                right: 'on the right'

which outputs following values within corrosponding md file when saved:

YAML
news_content:
    -
        additional_content_select: default
        additional_content_pos:
            additional_content_pos:
                pos: left

if I delete the additional nesting, then values a referenced correctly within the form:

YAML
news_content:
    -
        additional_content_select: default
        additional_content_pos:
            pos: left
last edited 04/21/21 by Alex

Suggested topics

Topic Participants Replies Views Activity
Forms & Blueprints · by Ton Haarmans, 5 years ago
13 1135 4 months ago
Forms & Blueprints · by Hugo Oliveira, 5 months ago
0 60 5 months ago
Forms & Blueprints · by Flachy Joe, 6 months ago
9 132 6 months ago
Forms & Blueprints · by Augustus, 7 months ago
7 108 7 months ago
Forms & Blueprints · by Julien, 7 months ago
10 127 7 months ago