npm.io
1.0.2 • Published 2 years ago

coreui-form-field-select2

Licence
ISC
Version
1.0.2
Deps
3
Size
2.2 MB
Vulns
0
Weekly
0

Coreui form field select2

Online documentation

php repository

Install

npm install coreui-form-field-select2

Examples

<div id="single-select"></div>

<script>
    let options = [
        '--',
        'Reactive',
        'Solution',
        'Conglomeration',
        'Algoritm',
        'Holistic',
    ];

    CoreUI.form.create({
        send    : {
            url   : '/path/to/object/1',
            method: 'post'
        },
        record  : {
            select_field: null
        },
        fields  : [
            {
                type: 'select2', name: 'select_field', label: 'Select', width: 250, options: options, select2: {
                    placeholder: 'Choose one thing',
                }
            },
        ],
        onSubmit: function (form, data) {
            alert(JSON.stringify(data));
            return false;
        },
        controls: [
            {type: "submit", content: "Send"},
        ],
    }).render('single-select');
</script>