Draggable / formeo

Drag & Drop Form Builder
http://draggable.github.io/formeo/
MIT License
534 stars 196 forks source link

How to use elementOrder? #269

Closed tsawler closed 4 years ago

tsawler commented 4 years ago

This is a great package, and it works very well!

I'm trying to figure out how to make elementOrder work. In the example below, I have added two elements, email and password, and removed file upload. I think I have the syntax right, but something must be wrong, since no matter what I do the two I've added appear at the top of the list.

Any suggestions? Thanks in advance for any help you might be able to provide.

formeo = new FormeoEditor({
    editorContainer: '#fb-editor',
    controls: {
        disable: {
            elements: ['upload'],
        },
        elements: [
            {
                tag: 'input',
                config: {
                    label: 'Password',
                    disabledAttrs: ['type']
                },
                meta: {
                    group: 'common',
                    id: 'password',
                    icon: '<i class="fa fa-lock fa-2x"></i>',
                },
                attrs: {
                    type: 'password'
                },
            },
            {
                tag: 'input',
                config: {
                    label: 'Email',
                    disabledAttrs: ['type'],
                    lockedAttrs: [],
                },
                meta: {
                    group: 'common',
                    id: 'email',
                    icon: '<i class="fa fa-envelope fa-2x"></i>',
                },
                attrs: {
                    type: 'email',
                    name: 'email',
                },
            },
        ],
        elementOrder: {
            // Must be set in conjunction or it may not appear in the group
            common: ['button','checkbox','date-input','email','email','hidden','number','password','textarea','text','select','radio'],
        },
    },

});
tsawler commented 4 years ago

Actually, never mind. It worked. It must have been a cache thing.