Ejemplo n.º 1
0
 static function validateMultiSelectList($field, $value)
 {
     $req = $field->required;
     $list = FieldController::getList($field);
     if ($req == 1 && $value == null | $value == "") {
         return $field->name . ' field is required.';
     }
     if (sizeof(array_diff($value, $list)) > 0) {
         return "Value(s) for field " . $field->name . " not in list of options";
     }
     return '';
 }
Ejemplo n.º 2
0
<div class="form-group">
    <?php 
if ($genlist == null) {
    $value = '';
    $value2 = \App\Http\Controllers\FieldController::getList($field, false);
} else {
    $value = explode('[!]', $genlist->options);
    $value2 = array();
    foreach ($value as $val) {
        $value2[$val] = $val;
    }
}
?>
    {!! Form::label($field->flid, $field->name.': ') !!}
    @if($field->required==1)
        <b style="color:red;font-size:20px">*</b>
    @endif
    {!! Form::select($field->flid.'[]',$value2, $value,['class' => 'form-control', 'Multiple', 'id' => 'list'.$field->flid]) !!}
</div>

<script>
    $('#list{{ $field->flid }}').select2({
        tags: true
    });
</script>