setMode('development'); /* Checkboxes -------------------------------------------------- */ $form->addHtml('

Switches with Checkboxes - Built using lcswitch plugin

'); $form->startFieldset('Default checkbox switch'); $form->addCheckbox('vertical-checkbox', 'Label 1', 1, 'class=lcswitch mb-3'); $form->addCheckbox('vertical-checkbox', 'Label 2', 2, 'class=lcswitch mb-3, checked'); $form->printCheckboxGroup('vertical-checkbox', 'Vertical checkbox switch', false); $form->addCheckbox('horizontal-checkbox', 'First', 1, 'class=lcswitch, checked'); $form->addCheckbox('horizontal-checkbox', 'Second', 2, 'class=lcswitch, checked'); $form->addCheckbox('horizontal-checkbox', 'Third', 3, 'class=lcswitch'); $form->printCheckboxGroup('horizontal-checkbox', 'Horizontal checkboxes'); $form->endFieldset(); $form->startFieldset('Dependent field - Switch on the 1st switch to show the field below'); $form->startDependentFields('vertical-checkbox', 1); $form->addInput('text', 'name', 'value', 'label', 'required'); $form->endDependentFields(); $form->endFieldset(); $form->startFieldset('Styled checkbox switch'); $form->setCols(0, 12); $form->addCheckbox('styled-checkbox', 'black', 1, 'class=lcswitch, data-theme=black, checked'); $form->addCheckbox('styled-checkbox', 'blue', 1, 'class=lcswitch, data-theme=blue, checked'); $form->addCheckbox('styled-checkbox', 'blue-gray', 1, 'class=lcswitch, data-theme=blue-gray, checked'); $form->addCheckbox('styled-checkbox', 'cyan', 1, 'class=lcswitch, data-theme=cyan, checked'); $form->addCheckbox('styled-checkbox', 'gray', 1, 'class=lcswitch, data-theme=gray, checked'); $form->addCheckbox('styled-checkbox', 'gray-dark', 1, 'class=lcswitch, data-theme=gray-dark, checked'); $form->addCheckbox('styled-checkbox', 'green', 1, 'class=lcswitch, data-theme=green, checked'); $form->addCheckbox('styled-checkbox', 'indigo', 1, 'class=lcswitch, data-theme=indigo, checked'); $form->addCheckbox('styled-checkbox', 'orange', 1, 'class=lcswitch, data-theme=orange, checked'); $form->addCheckbox('styled-checkbox', 'pink', 1, 'class=lcswitch, data-theme=pink, checked'); $form->addCheckbox('styled-checkbox', 'purple', 1, 'class=lcswitch, data-theme=purple, checked'); $form->addCheckbox('styled-checkbox', 'red', 1, 'class=lcswitch, data-theme=red, checked'); $form->addCheckbox('styled-checkbox', 'teal', 1, 'class=lcswitch, data-theme=teal, checked'); $form->addCheckbox('styled-checkbox', 'white', 1, 'class=lcswitch, data-theme=white, checked'); $form->addCheckbox('styled-checkbox', 'yellow', 1, 'class=lcswitch, data-theme=yellow, checked'); $form->printCheckboxGroup('styled-checkbox', '', true); $form->endFieldset(); $form->startFieldset('Custom text checkbox switch + custom theme'); $form->setCols(4, 8); $form->addCheckbox('horizontal-custom-checkbox', 'Apples?', 1, 'class=lcswitch, data-ontext=Yes, data-offtext=No, data-theme=red, checked'); $form->addCheckbox('horizontal-custom-checkbox', 'Bananas?', 2, 'class=lcswitch, data-ontext=Yes, data-offtext=No, data-theme=red'); $form->printCheckboxGroup('horizontal-custom-checkbox', 'Do you like:'); $form->endFieldset(); /* Radio buttons -------------------------------------------------- */ $form->addHtml('

Switches with Radio buttons - Built using lcswitch plugin

'); $form->startFieldset('Default radio switch'); $form->addRadio('vertical-radio', 'Label 1', 1, 'class=lcswitch, checked'); $form->addRadio('vertical-radio', 'Label 2', 2, 'class=lcswitch'); $form->printRadioGroup('vertical-radio', 'Vertical radio switch', false); $form->addRadio('horizontal-radio', 'First', 1, 'class=lcswitch, checked'); $form->addRadio('horizontal-radio', 'Second', 2, 'class=lcswitch, checked'); $form->addRadio('horizontal-radio', 'Third', 3, 'class=lcswitch'); $form->printRadioGroup('horizontal-radio', 'Horizontal radios'); $form->endFieldset(); $form->startFieldset('Styled radio switch'); $form->setCols(0, 12); $form->addRadio('styled-radio', 'black', 1, 'class=lcswitch, data-theme=black, checked'); $form->addRadio('styled-radio', 'blue', 1, 'class=lcswitch, data-theme=blue, checked'); $form->addRadio('styled-radio', 'blue-gray', 1, 'class=lcswitch, data-theme=blue-gray, checked'); $form->addRadio('styled-radio', 'cyan', 1, 'class=lcswitch, data-theme=cyan, checked'); $form->addRadio('styled-radio', 'gray', 1, 'class=lcswitch, data-theme=gray, checked'); $form->addRadio('styled-radio', 'gray-dark', 1, 'class=lcswitch, data-theme=gray-dark, checked'); $form->addRadio('styled-radio', 'green', 1, 'class=lcswitch, data-theme=green, checked'); $form->addRadio('styled-radio', 'indigo', 1, 'class=lcswitch, data-theme=indigo, checked'); $form->addRadio('styled-radio', 'orange', 1, 'class=lcswitch, data-theme=orange, checked'); $form->addRadio('styled-radio', 'pink', 1, 'class=lcswitch, data-theme=pink, checked'); $form->addRadio('styled-radio', 'purple', 1, 'class=lcswitch, data-theme=purple, checked'); $form->addRadio('styled-radio', 'red', 1, 'class=lcswitch, data-theme=red, checked'); $form->addRadio('styled-radio', 'teal', 1, 'class=lcswitch, data-theme=teal, checked'); $form->addRadio('styled-radio', 'white', 1, 'class=lcswitch, data-theme=white, checked'); $form->addRadio('styled-radio', 'yellow', 1, 'class=lcswitch, data-theme=yellow, checked'); $form->printRadioGroup('styled-radio', '', true); $form->endFieldset(); $form->startFieldset('Custom text radio switch + custom theme'); $form->setCols(4, 8); $form->addRadio('horizontal-custom-radio', 'Apples?', 1, 'class=lcswitch, data-ontext=Yes, data-offtext=No, data-theme=red, checked'); $form->addRadio('horizontal-custom-radio', 'Bananas?', 2, 'class=lcswitch, data-ontext=Yes, data-offtext=No, data-theme=red'); $form->printRadioGroup('horizontal-custom-radio', 'Do you like:'); $form->endFieldset(); ?> Bootstrap 4 Form with radio and checkboxes switches - How to create PHP forms easily printIncludes('css'); ?>

Php Form Builder - Bootstrap 4 Form
with radio and checkboxes switches

render(); ?>
printIncludes('js'); $form->printJsCode(); ?>