diff --git a/app/Http/Controllers/CustomFieldsController.php b/app/Http/Controllers/CustomFieldsController.php index da4bd08550..43540ed421 100644 --- a/app/Http/Controllers/CustomFieldsController.php +++ b/app/Http/Controllers/CustomFieldsController.php @@ -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')); } diff --git a/resources/views/livewire/custom-field-set-default-values-for-model.blade.php b/resources/views/livewire/custom-field-set-default-values-for-model.blade.php index 220956115c..4ece5ab0ae 100644 --- a/resources/views/livewire/custom-field-set-default-values-for-model.blade.php +++ b/resources/views/livewire/custom-field-set-default-values-for-model.blade.php @@ -46,7 +46,9 @@ defaultValue($model_id) == $field_value ? 'checked="checked"': '' }} />{{ $field_value }}
@endforeach @elseif($field->element == "checkbox") - defaultValue($model_id) ? 'checked="checked"': '' }}/> + @foreach(explode("\r\n", $field->field_values) as $field_value) + defaultValue($model_id))) ? 'checked="checked"': '' }} /> {{ $field_value }}
+ @endforeach @else Unknown field element: {{ $field->element }}