Add wire:keys

This commit is contained in:
Marcus Moore 2024-08-15 10:40:23 -07:00
parent 6ab976f353
commit e7c9c799bb
No known key found for this signature in database

View file

@ -64,7 +64,13 @@
<select class="form-control" name="default_values[{{ $field->id }}]">
<option value=""></option>
@foreach(explode("\r\n", $field->field_values) as $field_value)
<option value="{{$field_value}}" {{ $field->defaultValue($model_id) == $field_value ? 'selected="selected"': '' }}>{{ $field_value }}</option>
<option
value="{{$field_value}}"
{{ $field->defaultValue($model_id) == $field_value ? 'selected="selected"': '' }}
wire:key="listbox-{{ $field_value }}"
>
{{ $field_value }}
</option>
@endforeach
</select>
@ -72,7 +78,7 @@
@elseif($field->element == "radio")
@foreach(explode("\r\n", $field->field_values) as $field_value)
<label class="col-md-3 form-control" for="{{ str_slug($field_value) }}">
<label class="col-md-3 form-control" for="{{ str_slug($field_value) }}" wire:key="radio-{{ $field_value }}">
<input id="{{ str_slug($field_value) }}" aria-label="{{ str_slug($field->name) }}" type='radio' name="default_values[{{ $field->id }}]" value="{{$field_value}}" {{ $field->defaultValue($model_id) == $field_value ? 'checked="checked"': '' }} />{{ $field_value }}
</label>
@endforeach
@ -80,7 +86,7 @@
@elseif($field->element == "checkbox")
@foreach(explode("\r\n", $field->field_values) as $field_value)
<label class="col-md-3 form-control" for="{{ str_slug($field_value) }}">
<label class="col-md-3 form-control" for="{{ str_slug($field_value) }}" wire:key="checkbox-{{ $field_value }}">
<input id="{{ str_slug($field_value) }}" type="checkbox" aria-label="{{ str_slug($field->name) }}" name="default_values[{{ $field->id }}][]" value="{{ $field_value }}"{{ in_array($field_value, explode(', ',$field->defaultValue($model_id))) ? ' checked="checked"': '' }}> {{ $field_value }}
</label>
@endforeach