FormsBootstrap

A Laravel library to generate forms based on Laravel Collective Forms & HTML, Boostrap 5 CSS Framework, RichText editor, and Icons provided by FontAwesome. Current version: 2.1.7. Project on GitHub. Project on Packagist. Manages also results inputs of packages DateRangePickerHelper, Uploader, and Tags input. Includes form management and validation. This demosite sources available here.

Checkboxes and radio buttons



{!! Form::bsCheckbox([
  'name' => 'os', //name of checkboxes
  'values' => ['mac' => 'MacOs','windows' => 'Windows', 'linux' => 'Linux',
      'vms' => 'Vms','unix' => 'Unix'], //values of checkboxes
  'checkedvalues' => ['vms', 'mac'], // array keys of selected values
  'mainlabel' => 'Operating system' // Label for checkboxes list
]) !!}
{!! Form::bsRadio([
  'name' => 'priority',
  'values' => ['lowest' => 'Lowest','low' => 'Low', 'medium' => 'Medium', 'high' => 'High','highest' => 'Highest'],
  'checkedvalue' => 'medium',  //since only one radio button can be selected, string value
  'mainlabel' => 'Priority'
]) !!}
{!! Form::bsCheckbox([
  'name' => 'languages',
  'values' => ['en' => 'English', 'fr' => 'Français', 'de' => 'Deutsch', 'it' => 'Italiano',
        'es' => 'Español', 'pt' => 'Português'],
  'mainlabel' => 'Languages',
  'switch' => true, // Bootstrap switch values
  'required' => true // at least one value must be selected
]) !!}
{!! Form::bsCheckbox([
  'name' => 'conditions',
  'values' => ['accepted' => 'I agree to terms and conditions'],
  'required' => true,
  'invalid-feedback' => "You must agree before submitting." // this message will be displayed
                                                            //if no value selected
]) !!}

Output:
<div class="mb-3 resetcheck" id="main_os"
>
<label class="form-label">Operating system</label><br/>
<div class="form-check form-check-inline">
<input type="checkbox" id="os_mac" class="form-check-input" name="os[]" value="mac"
checked="checked" defaultchecked="defaultchecked"
/>
<label class="form-check-label" for="os_mac">MacOs</label>
</div>
<div class="form-check form-check-inline">
<input type="checkbox" id="os_windows" class="form-check-input" name="os[]" value="windows"
/>
<label class="form-check-label" for="os_windows">Windows</label>
</div>
<div class="form-check form-check-inline">
<input type="checkbox" id="os_linux" class="form-check-input" name="os[]" value="linux"
/>
<label class="form-check-label" for="os_linux">Linux</label>
</div>
<div class="form-check form-check-inline">
<input type="checkbox" id="os_vms" class="form-check-input" name="os[]" value="vms"
checked="checked" defaultchecked="defaultchecked"
/>
<label class="form-check-label" for="os_vms">Vms</label>
</div>
<div class="form-check form-check-inline">
<input type="checkbox" id="os_unix" class="form-check-input" name="os[]" value="unix"
/>
<label class="form-check-label" for="os_unix">Unix</label>
</div>
</div>
<div class="mb-3 resetradio" id="main_priority"
>
<label class="form-label">Priority</label><br/>
<div class="form-check form-check-inline">

<input type="radio" id="priority_lowest" class="form-check-input" name="priority" value="lowest"
/>
<label class="form-check-label" for="priority_lowest">Lowest</label>
</div>
<div class="form-check form-check-inline">

<input type="radio" id="priority_low" class="form-check-input" name="priority" value="low"
/>
<label class="form-check-label" for="priority_low">Low</label>
</div>
<div class="form-check form-check-inline">

<input type="radio" id="priority_medium" class="form-check-input" name="priority" value="medium"
checked="checked" defaultchecked="defaultchecked"
/>
<label class="form-check-label" for="priority_medium">Medium</label>
</div>
<div class="form-check form-check-inline">

<input type="radio" id="priority_high" class="form-check-input" name="priority" value="high"
/>
<label class="form-check-label" for="priority_high">High</label>
</div>
<div class="form-check form-check-inline">

<input type="radio" id="priority_highest" class="form-check-input" name="priority" value="highest"
/>
<label class="form-check-label" for="priority_highest">Highest</label>
</div>
</div>
<div class="mb-3 selcheck resetcheck" id="main_languages"
>
<label class="form-label">Languages</label><br/>
<div class="form-check form-check-inline form-switch verify-check">
<input type="checkbox" id="languages_en" class="form-check-input" name="languages[]" value="en"
role="switch"
/>
<label class="form-check-label" for="languages_en">English</label>
</div>
<div class="form-check form-check-inline form-switch verify-check">
<input type="checkbox" id="languages_fr" class="form-check-input" name="languages[]" value="fr"
role="switch"
/>
<label class="form-check-label" for="languages_fr">Français</label>
</div>
<div class="form-check form-check-inline form-switch verify-check">
<input type="checkbox" id="languages_de" class="form-check-input" name="languages[]" value="de"
role="switch"
/>
<label class="form-check-label" for="languages_de">Deutsch</label>
</div>
<div class="form-check form-check-inline form-switch verify-check">
<input type="checkbox" id="languages_it" class="form-check-input" name="languages[]" value="it"
role="switch"
/>
<label class="form-check-label" for="languages_it">Italiano</label>
</div>
<div class="form-check form-check-inline form-switch verify-check">
<input type="checkbox" id="languages_es" class="form-check-input" name="languages[]" value="es"
role="switch"
/>
<label class="form-check-label" for="languages_es">Español</label>
</div>
<div class="form-check form-check-inline form-switch verify-check">
<input type="checkbox" id="languages_pt" class="form-check-input" name="languages[]" value="pt"
role="switch"
/>
<label class="form-check-label" for="languages_pt">Português</label>
</div>
<div class="invalid-feedback">Select at least one of the above values</div>
</div>
<div class="mb-3 selcheck resetcheck" id="main_conditions"
>
<div class="form-check form-check-inline verify-check">
<input type="checkbox" id="conditions_accepted" class="form-check-input" name="conditions[]" value="accepted"
/>
<label class="form-check-label" for="conditions_accepted">I agree to terms and conditions</label>
</div>
<div class="invalid-feedback">You must agree before submitting.</div>
</div>






Select at least one of the above values
You must agree before submitting.


Results