-
-
Notifications
You must be signed in to change notification settings - Fork 334
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
bug #2491 [LiveComponent] Fix `ComponentWithFormTrait::extractFormVal…
…ues()` with edge cases (smnandre) This PR was squashed before being merged into the 2.x branch. Discussion ---------- [LiveComponent] Fix `ComponentWithFormTrait::extractFormValues()` with edge cases | Q | A | ------------- | --- | Bug fix? | yes | New feature? | no <!-- please update src/**/CHANGELOG.md files --> | Issues | Fix #2487 | License | MIT #2403 fixed an old bug to simulate browser behaviour when a select field has no option selected, no placeholder, and is required (it then uses the first option) #2425 and #2426 fixed the way we handled empty strings as placeholders In #2487 `@maciazek` explained us how a custom type with a "choices" option became unusable since the last changes. Also.. while I was reading all this I realized we returned wrong values here when "option groups" were used.. leading to other problems. I updated the code of `extractFormValues()` method to: * check if most of the caracteristic keys added in `ChoiceType::buildView` were defined in the `$view->vars`, to ensure we are dealing with a `<select>` field built by a `ChoiceType` * fetch recursively the value of the first displayed option (even with groups) Commits ------- b7f1ba4 [LiveComponent] Fix `ComponentWithFormTrait::extractFormValues()` with edge cases
- Loading branch information
Showing
4 changed files
with
39 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters