Announcement Announcement Module
No announcement yet.
Freemarker via spring.ftl unable to specify field ids Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Freemarker via spring.ftl unable to specify field ids

    Hi all,

    I'm using Spring 2.5.6 and was wondering if someone can help me understand how to use the spring.ftl form fields properly. My problem stems from how all the form fields specify id="${status.expression}" or similar, which means this cannot be overridden.

    This restricts the macros to very limited use cases. For instance you cannot use it on a page when:

    1) You have multiple forms binding to the same command object, since the field "id" will not be unique.

    2) You have multiple forms binding to different command objects, but the command objects have similar properties. eg and

    3) There is an implicit link to references to the "id" such as when specifying a <label for="the_id"> and when using in Javascripts.

    I'm not sure why the spring.ftl even need to bother setting the ids, since the serverside is really only concerned with the "name" value. The ids can already be specified by the "attributes" catch-all.

    Some patches I can see for spring.ftl are:

    a) Don't bother with specifying the "id" by default

    (if the developer specifies "id" then that info is to be cascaded to nested elements like <option>)


    b) Use ${status.expression} only if an override isn't specified

    Any help from how people are using the spring.ftl fields which overcome these issues is much appreciated. Apologies if my question is dumb or way off track.