Skip to content
This repository was archived by the owner on Mar 18, 2025. It is now read-only.

Commit 619cd80

Browse files
committed
Use loose comparison for select options - #11
1 parent 85fc529 commit 619cd80

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/Components/Inputs/Select.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,13 @@ public function __construct(
4949

5050
public function isSelected($key): bool
5151
{
52-
if ($this->selectedKey === $key) {
52+
/*
53+
* Not using a strict comparison so that numeric key values can be shown
54+
* as "selected" too. e.g. 1 == '1'
55+
*
56+
* See: https://github.com/rawilk/laravel-form-components/issues/11
57+
*/
58+
if ($this->selectedKey == $key) {
5359
return true;
5460
}
5561

0 commit comments

Comments
 (0)