SpringSelectFieldAttrProcessor optgroup bug

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

SpringSelectFieldAttrProcessor optgroup bug

FingolfinTEK
Hi Daniel,

I've noticed that Thymeleaf doesn't fully support select tags which has its option tags grouped inside optgroup tags. Here's an example:

<select th:field="*{fooOption}">
    <optgroup label="Foo">
        <option th:each="foo : ${foos}" th:value="${foo.id}">Foo-1</option>
    </optgroup>
    <optgroup label="Bar">
        <option th:each="bar : ${bars}" th:value="${bar.id}">Bar-1</option>
    </optgroup>
</select>

So, if we have a situation similar to the above-mentioned one, when the form is reposted (let's say that there were some validation errors) the first option is selected instead of the real selection because the current select processor expects to see only option tags as the select tag's children. We've fixed this internally but I thought that someone else might want to use the optgroup tag so I'm reporting the bug here :)
Fingolfin like a shooting light
beneath a cloud, a stab of white,
sprang then aside, and Ringil drew
like ice that gleameth cold and blue,
his sword devised of elvish skill
to pierce the flesh with deadly chill.
Reply | Threaded
Open this post in threaded view
|

Re: SpringSelectFieldAttrProcessor optgroup bug

danielfernandez
Administrator
Yup, I'm afraid this is -was- a bug.

I've just uploaded a snapshot release for version 1.1.2-SNAPSHOT that fixes this.

See http://www.thymeleaf.org/faq.html#use-snapshot

Thanks!

Daniel.