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

Spacer in forms

Started by Muut Archive 10 years ago · 2 replies · 366 views
10 years ago

I'm attempting to use the "spacer" form field. Are the spacers supposed to show in order along with the other fields? They're all showing at the top of the form whenever I use them.

I have something like this:

YAML
fields:
        -
            type: spacer
            title: Basics
            text: 'Lets start with your information.'
        -
            name: name
        -
            name: organization
        -
            type: spacer
            title: 'Contact Information'
            text: 'How can we get in touch with you?'
        -
            name: email 
        -
            name: phone
10 years ago

The ordering works if you add a "name" to the spacer:

YAML
        -
            type: spacer
            title: 'Contact Information'
            text: 'How can we get in touch with you?'
            name: spacer

The name has to be unique for each spacer.

10 years ago

Generally fields are described like this:

YAML
fields:
        spacer1:
            type: spacer
            title: Basics
            text: 'Lets start with your information.'
        name:
            type: text
        organization:
            type: text
        spacer2:
            type: spacer
            title: 'Contact Information'
            text: 'How can we get in touch with you?'
        email:
            type: email
        phone:
            type: text 

This way each field has a unique name as that key is used for name: by default.

Suggested topics

Topic Participants Replies Views Activity
Archive · by Deleted User, 9 years ago
0 1368 9 years ago
Archive · by Muut Archive, 9 years ago
2 940 9 years ago
Archive · by Muut Archive, 9 years ago
2 4069 9 years ago
Archive · by Muut Archive, 9 years ago
1 2960 9 years ago
Archive · by Muut Archive, 9 years ago
3 1125 9 years ago