Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
th:field should render hidden field before checkbox to not break common checkbox replacements #178
Almost all custom checkbox replacement solutions, be it in Bootstrap, Foundation or Materialize CSS, depend upon the following HTML structure:
This is due to the limitations of CSS where usually the visual checkbox replacement is implemented like this:
Which means the replacement can only work if the
Of course CSS also has the
There is no problem that you're adding a hidden field when using
Note: I am aware of #68 but the person closing that issue seemingly did not grasp the problem.
I am also facing this exact problem and there doesn't appear to be a clean workaround without hacking my standardized CSS to support this specific use case. If anyone knows how to configure Thymeleaf to insert the hidden input BEFORE the checkbox input, please us know!
BTW, this appears to be the offending code: https://github.com/thymeleaf/thymeleaf-spring/blob/3.0-master/thymeleaf-spring5/src/main/java/org/thymeleaf/spring5/processor/SpringInputCheckboxFieldTagProcessor.java
SpringStandardDialect dialect = ...; dialect.setRenderHiddenMarkersBeforeCheckboxes(true);
SpringTemplateEngine templateEngine = ...; templateEngine.setRenderHiddenMarkersBeforeCheckboxes(true);