Description
Richard Paul opened SPR-6120 and commented
In Spring 3.0 the Velocity macro spring.vm introduces springFormCheckbox, a handy macro for generating a checkbox and associated field marker.
However there is a bug in the implementation which causes the checkbox to always be checked. This is due to the way the checked attribute is used in HTML, if a checked attribute is present, regardless of its value, then the checkbox is checked. The macro writes checked="false" when the input should not be selected, resulting in the attribute actually being checked.
Currently:
<input type="checkbox" id="${status.expression}" name="${status.expression}" checked="#if("$!{status.value}"=="true")true#{else}false#end" ${attributes}/>
Should be:
<input type="checkbox" id="${status.expression}" name="${status.expression}" #if("$!{status.value}"=="true")checked="true"#end ${attributes}/>
Affects: 3.0 M4
Issue Links:
- Add single checkbox input macro for Velocity and Freemarker [SPR-4700] #9377 Add single checkbox input macro for Velocity and Freemarker
Referenced from: commits 6420fd3