Skip to content

Commit d33d6be

Browse files
authored
Merge pull request #26 from dipcode-software/fix/choices
Fixed choice value when comparing
2 parents 194f3be + 2212981 commit d33d6be

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](http://keepachangelog.com/)
55
and this project adheres to [Semantic Versioning](http://semver.org/).
66

7+
## [2.1.1] - 2018-04-20
8+
### Fixed
9+
- Forced choice value to be string when marking selected
10+
711
## [2.0.4] - 2018-03-XX
812
### Fixed
913
- `data` and `files` were wrongly exposed on `Form` class. Changed visibility to private and added `getData` and `getFiles` methods.

src/Widgets/ChoiceWidget.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ public function getOptions(string $name, $value, array $attrs = null)
102102
$selected = false;
103103

104104
if (!$has_selected || $this->allow_multiple_selected) {
105-
$has_selected = $selected = in_array($choice_value, $value);
105+
$has_selected = $selected = in_array(strval($choice_value), $value);
106106
}
107107

108108
$subwidgets[] = $this->buildOption(

0 commit comments

Comments
 (0)