-
Notifications
You must be signed in to change notification settings - Fork 38.8k
Closed
Labels
in: webIssues in web modules (web, webmvc, webflux, websocket)Issues in web modules (web, webmvc, webflux, websocket)type: enhancementA general enhancementA general enhancement
Milestone
Description
Jean opened SPR-15871 and commented
Unchecked checkbox value should be recognized via WebDataBinder#fieldMarkerPrefix.
However when creating attribute, only constructor parameter names used, so field marker is not applied.
When this html form submit:
<form>
<input type="checkbox" name="a" value="true">
<input type="hidden" name="_a" value="on">
</form>- kotlin code
@Controller
class TestController {
class Form(val a: Boolean = true)
@RequestMapping
fun handle(@ModelAttribute form: Form) {
}
}
when checkbox is unchecked, request should be:
?_a=on
and the value of form.a should be false, but currently it remains true.
Line 238 in 61cdc84
| String[] paramNames = (cp != null ? cp.value() : parameterNameDiscoverer.getParameterNames(ctor)); |
Affects: 5.0 RC3
Issue Links:
- Data binding with immutable objects (Kotlin / Lombok / @ConstructorProperties) [SPR-15199] #19763 Data binding with immutable objects (Kotlin / Lombok /
@ConstructorProperties) - BindingResult support for constructor argument mismatch on immutable data object [SPR-15542] #20101 BindingResult support for constructor argument mismatch on immutable data object
- Revisit handling of missing fields (without default values) for immutable data classes [SPR-15877] #20432 Revisit handling of missing fields (without default values) for immutable data classes
Metadata
Metadata
Assignees
Labels
in: webIssues in web modules (web, webmvc, webflux, websocket)Issues in web modules (web, webmvc, webflux, websocket)type: enhancementA general enhancementA general enhancement