i want to show the full time as a default selected in dropdown. The coding i need to alter is not showing the value, is suppose to be select the full time as default:
this is the data:
this is the coding:
<div class="form-group">
<label class="col-lg-2 control-label"></label>
<div class="col-lg-6">
{!! Form::dropdown('program['.$i.'][study_mode_id]', $study_mode, @$student_program[$i]->study_mode_id,'class="select2-form" ') !!}
</div>
</div>
this is the helpers i use:
public static function dropdown($name = 'dropdown', $option, $value = ' ', $additional = '')
{
$classmsg = "form-control";
$additional = Forms::additional($additional, $classmsg);
// if (is_array($option)){
// if ($value != '' && !array_key_exists($value, $option))
// {
// $option[$value] = '*data is not available (use this if not intend to change)';
// }
// }
// else{
// if ($value != '' && !array_key_exists($value, $option->pluck('id')->toArray()))
// {
// $option_object = (object) array('id' => $value, 'name' => '*data is not available (use this if not intend to change)');
// $option->push($option_object);
// }
// }
$data = array(
'name' => $name,
'option' => $option,
// 'value' => array($value),
'value' => ($value !== '') ? array($value) : $value,
'extra' => $additional['extra'],
'class' => $additional['class'],
'type' => '',
'select2' => 'select2-filter',
);
return view('widget.form_dropdown')->with($data)->render();
}
from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2QBIFhm
via IFTTT
Aucun commentaire:
Enregistrer un commentaire