Skip to content

Commit 7d04e63

Browse files
committed
added fix which ensures that the first selected option of a list is the nonSelectable prompt and not the first selectable option. This occured due to NULL being 0 and the old compare then using 0
1 parent 7e5ac83 commit 7d04e63

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

resources/views/public/components/forms/select-question.blade.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,17 @@ class="select form-field-text focus:select-secondary
1616
bg-white @endif
1717
1818
">
19-
<option disabled @if (old($sectionName) === null) selected @endif>{{ $placeholder }}</option>
20-
{{-- from https://laravel.com/docs/11.x/blade#additional-attributes --}}
19+
<option disabled @if (old($sectionName, '') === '') selected @endif>{{ $placeholder }}</option>
2120
@foreach ($options as $key => $option)
22-
<option value="{{ $key }}" @selected(old($sectionName) == $key)>
21+
<option value="{{ $key }}" @selected(old($sectionName, '') === (string) $key)>
2322
{{ $option }}
2423
</option>
2524
@endforeach
2625
</select>
2726
@if ($errors->has($sectionName))
2827
<p class="error-highlight"> {{ $errors->first($sectionName) }} </p>
2928
@endif
29+
30+
3031
</div>
3132
</div>

0 commit comments

Comments
 (0)