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-issuemaster opened this issue Aug 8, 2018 · 2 comments
Assignees
Milestone

Comments

@spring-issuemaster
Copy link
Collaborator

@spring-issuemaster spring-issuemaster commented Aug 8, 2018

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-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

@spring-issuemaster spring-issuemaster commented Aug 8, 2018

Juergen Hoeller commented

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

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

@spring-issuemaster spring-issuemaster commented Aug 8, 2018

Ander Ruiz commented

Thanks for solving this so fast! Awesome :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.