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: 3.1.1. 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.

Select



{!! Form::bsSelect([
  'name' => 'priority', // name returned to form
  'labeltext' => 'Priority',
  'values' => ['lowest' => 'Lowest','low' => 'Low', 'medium' => 'Medium','high' => 'High','highest' => 'Highest'], //values
  'default' => 'medium' // key of default value
]) !!}
{!! Form::bsSelect([
  'name' => 'os',
  'labeltext' => 'Operating system',
  'values' => ['mac' => 'MacOs','windows' => 'Windows', 'linux' => 'Linux', 'vms' => 'Vms','unix' => 'Unix'],
  'default' => 'linux,mac',
  'multiple' => true // multiple values field
  'required' => true
]) !!}

Output:
<div class="mb-3" id="fg-priority">
<label for="priority" class="form-label">Priority</label>
<select name="priority" id="priority" class="form-select resetselect">
<option value="lowest">Lowest</option>
<option value="low">Low</option>
<option value="medium" defaultchecked="defaultchecked" selected="selected">Medium</option>
<option value="high">High</option>
<option value="highest">Highest</option>
</select>
<div class="invalid-feedback">This field is required</div>
</div>
<div class="mb-3" id="fg-os">
<label for="os" class="form-label">Operating system</label>
<select name="os[]" id="os" class="form-select verify resetselect" multiple="multiple">
<option value="mac" defaultchecked="defaultchecked" selected="selected">MacOs</option>
<option value="windows">Windows</option>
<option value="linux" defaultchecked="defaultchecked" selected="selected">Linux</option>
<option value="vms">Vms</option>
<option value="unix">Unix</option>
</select>
<div class="invalid-feedback">This field is required</div>
</div>



This field is required
This field is required


Results