Announcement Announcement Module
No announcement yet.
bug? -- freemarker/spring.ftl: formMultiSelect Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • bug? -- freemarker/spring.ftl: formMultiSelect

    The docs in chapter 13 of the documentation suggest that you can pass a map object as the options parameter to the "formMultiSelect" macro:

    Originally posted by form input generation macros
    options: a Map of all the available values that can be selected from in the input field. The keys to the map represent the values that will be POSTed back from the form and bound to the command object. Map objects stored against the keys are the labels displayed on the form to the user and may be different from the corresponding values posted back by the form. Usually such a map is supplied as reference data by the controller. Any Map implementation can be used depending on required behaviour. For strictly sorted maps, a SortedMap such as a TreeMap with a suitable Comparator may be used and for arbitrary Maps that should return values in insertion order, use a LinkedHashMap or a LinkedMap from commons-collections.
    In fact the options parameter to the formMultiSelect macro is treated as a sequence, and you get an error if you pass a hash type object to it.

  • #2

    I have this functioning for now by overriding the macro in my own template...

    <#macro formSingleSelect path options attributes="">
    <@spring.bind path/>
    <select name="${spring.status.expression}" ${attributes}>
    <#list options?keys as optionKey>
    <option <#if spring.status.value?default("")?string == optionKey?string>selected="true"</#if>

    Seems to work ok.
    I have created an account and will submit this issue to JIRA.