The Framework Code

twigs/framework/devel/tests/formother.twig

File List

{% import '@util/formmacro.twig' as f %}

    {{f.startform({id: 'tform2', on: {submit: 'false'} })}}
        {{f.number({label: 'Number', id : 'nmid1', name: 'nm1', value: 42, min: 30, step: 2, max: 50})}}
        {{f.number({label: 'Number Disabled', id : 'nmid2', name: 'nm2', value: 42, min: 30, step: 2, max: 50, disabled: TRUE})}}
        {{f.number({label: 'Number Readonly', id : 'nmid3', name: 'nm3', value: 42, min: 30, step: 2, max: 50, readonly: TRUE})}}

        {{f.range({label: 'Range', id : 'rnid1', name: 'rn1', dvalue: 15, min:10, step: 1, max: 20})}}
        {{f.range({label: 'Range Disabled', id : 'rnid2', name: 'rn2', dvalue: 15, min:10, step: 1, max: 20, disabled: TRUE})}}
        {{f.range({label: 'Range Readonly', id : 'rnid3', name: 'rn3', dvalue: 15, min:10, step: 1, max: 20, readonly: TRUE})}}

        {{f.datetime({label: 'DateTime', id : 'dtid', name: 'dt', ph: 'date time type'})}}

        {{f.file({label: 'File', id : 'flid', name: 'fl', accept: 'image/png'})}}
        {{f.file({label: 'File Disabled', id : 'flid', name: 'fl', accept: 'image/png', disabled: TRUE})}}

        {% set options = [
            {text: '—Select—', value: ''},
            {text: 'Value 1', value: 1},
            {text: 'Value 2', value: 2},
            {text: 'Value 3', value: 3},
            {text: 'Value 4', value: 4},
            {text: 'Value 5', value: 5},
        ] %}
        {{f.select({label: 'Select', is: 'slid21', name: 'sl21', selected: 1, options: options})}}
        {{f.select({label: 'Select Disabled', is: 'slid22', name: 'sl22', selected: 1, disabled: TRUE, options: options})}}
        {{f.select({label: 'Select readonly', is: 'slid23', name: 'sl23', selected: 1, readonly: TRUE, options: options})}}
        
        {{f.select({label: 'Select Multiple', is: 'slid11', name: 'sl11', size: 3, multiple: TRUE, selected: [1, 4], options: options})}}
        {{f.select({label: 'Select Multiple Disabled', is: 'slid12', name: 'sl12', size: 3, multiple: TRUE, selected: [1, 4], options: options, disabled: TRUE})}}
        {{f.select({label: 'Select Multiple Readonly', is: 'slid13', name: 'sl13', size: 3, multiple: TRUE, selected: [1, 4], options: options, readonly: TRUE})}}

        {{f.checkbox({group: TRUE, label: 'Checkbox', ids : ['ic1', 'ic2', 'ic3'], names: ['c1', 'c2', 'c3'], labels: [1, '2 (disabled)', 3], values: [ 1, 2, 3], check: [FALSE, FALSE, TRUE], disabled: [FALSE, TRUE, FALSE]})}}
        {{f.radio({group: TRUE, label: 'Radio', ids : ['ir1', 'ir2', 'ir3'], names: ['r1', 'r1', 'r1'], labels: [1, '2 (disabled)', 3], values: [ 1, 2, 3], check: [TRUE, FALSE, FALSE], disabled: [FALSE, TRUE, FALSE]})}}

        <p>{{f.submit({value: 'Submit Button', bstyle: 'btn-info'})}}</p>
    {{f.endform()}}