Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CheckboxTag incorrectly processing hidden field through RequestDataValueProcessor [SPR-17147] #21684

Closed
spring-projects-issues opened this issue Aug 8, 2018 · 2 comments
Assignees
Labels
in: web Issues in web modules (web, webmvc, webflux, websocket) status: backported An issue that has been backported to maintenance branches type: bug A general bug
Milestone

Comments

@spring-projects-issues
Copy link
Collaborator

Ander Ruiz opened SPR-17147 and commented

CheckBoxTag may create a hidden field which name will be "_checkBoxName" and its value is usually "on". The problem is that when this field is sent to RequestDataValueProcessor interface, instead of sending it as a "hidden" field it is sent as if it was a "checkbox", which is incorrect, in version 5.0.7 this line:

tagWriter.writeAttribute("value", processFieldValue(name, "on", getInputType()));

should be changed to:

tagWriter.writeAttribute("value", processFieldValue(name, "on", "hidden"));

At least the following classes suffer the same issue

spring-webmvc/src/main/java/org/springframework/web/servlet/tags/form/CheckboxesTag.java
spring-webmvc/src/main/java/org/springframework/web/servlet/tags/form/CheckboxTag.java

i.e. SelectTag is handling the hidden field properly


Affects: 4.3.18, 5.0.7

Referenced from: commits fa72186, 9580bbd, bd060a1

Backported to: 4.3.19

@spring-projects-issues
Copy link
Collaborator Author

Juergen Hoeller commented

Good catch! Fixed for 5.1 RC2 now, and to be backported to 5.0.9 and 4.3.19.

@spring-projects-issues
Copy link
Collaborator Author

Ander Ruiz commented

Thanks for solving this so fast! Awesome :)

@spring-projects-issues spring-projects-issues added type: bug A general bug status: backported An issue that has been backported to maintenance branches in: web Issues in web modules (web, webmvc, webflux, websocket) labels Jan 11, 2019
@spring-projects-issues spring-projects-issues added this to the 5.0.9 milestone Jan 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: web Issues in web modules (web, webmvc, webflux, websocket) status: backported An issue that has been backported to maintenance branches type: bug A general bug
Projects
None yet
Development

No branches or pull requests

2 participants