mirror of
https://github.com/snipe/snipe-it.git
synced 2024-12-25 05:34:06 -08:00
Merge pull request #11830 from inietov/fixes/default_values_for_checkboxes_unaccessible
Fixed #9801 #11199 Default Values for Checkbox Field Types Unaccessible
This commit is contained in:
commit
51d7f2b97b
|
@ -235,6 +235,10 @@ class CustomFieldsController extends Controller
|
|||
$field->format = e($request->get('format'));
|
||||
}
|
||||
|
||||
if($field->element == 'checkbox' || $field->element == 'radio'){
|
||||
$field->format = 'ANY';
|
||||
}
|
||||
|
||||
if ($field->save()) {
|
||||
return redirect()->route('fields.index')->with('success', trans('admin/custom_fields/message.field.update.success'));
|
||||
}
|
||||
|
|
|
@ -46,7 +46,9 @@
|
|||
<input type='radio' name="default_values[{{ $field->id }}]" value="{{$field_value}}" {{ $field->defaultValue($model_id) == $field_value ? 'checked="checked"': '' }} />{{ $field_value }}<br />
|
||||
@endforeach
|
||||
@elseif($field->element == "checkbox")
|
||||
<input type='checkbox' name="default_values[{{ $field->id }}]" {{ $field->defaultValue($model_id) ? 'checked="checked"': '' }}/>
|
||||
@foreach(explode("\r\n", $field->field_values) as $field_value)
|
||||
<input type='checkbox' name="default_values[{{ $field->id }}][]" value="{{$field_value}}" {{ in_array($field_value, explode(', ',$field->defaultValue($model_id))) ? 'checked="checked"': '' }} /> {{ $field_value }}<br />
|
||||
@endforeach
|
||||
@else
|
||||
<span class="help-block form-error">
|
||||
Unknown field element: {{ $field->element }}
|
||||
|
|
Loading…
Reference in a new issue