Uploaded image for project: 'Spring Roo'
  1. Spring Roo
  2. ROO-293

"title" domain field generates conflicting dom id for parent dom div id.

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Trivial
    • Resolution: Fixed
    • Affects Version/s: 1.0.0.RC2
    • Fix Version/s: 1.0.0.RC3
    • Component/s: WEB MVC
    • Labels:
      None
    • Environment:
      Windows, Java 6, Roo rc2

      Description

      The generated create.jspx code generated when a domain object has a "title" field element themes the first "title id in the page (the parent div id)

      generated code:

      {{
      <div xmlns:c="http://java.sun.com/jsp/jstl/core" xmlns:form="http://www.springframework.org/tags/form" xmlns:spring="http://www.springframework.org/tags">
      <script type="text/javascript">dojo.require("dijit.TitlePane");dojo.require("dijit.form.FilteringSelect");dojo.require("dijit.form.SimpleTextarea");</script>
      <div id="_title" style="width: 100%">
      <spring:message arguments="User" code="entity.create" var="title"/>
      <script type="text/javascript">Spring.addDecoration(new Spring.ElementDecoration({elementId : '_title', widgetType : 'dijit.TitlePane', widgetAttrs : {title: '${title}'}})); </script>
      <c:url value="/user" var="form_url"/>
      <form:form action="${form_url}" method="POST" modelAttribute="user">
      <div id="roo_user_title">
      <label for="_title">Title:</label>
      <form:select cssStyle="width:250px" id="_title" items="${_title}" path="title"/>
      <script type="text/javascript">Spring.addDecoration(new Spring.ElementDecoration({elementId : '_title', widgetType: 'dijit.form.FilteringSelect', widgetAttrs : {hasDownArrow : true}})); </script>
      <br/>
      <form:errors cssClass="errors" id="_title" path="title"/>
      </div>
      <br/>
      }}

      and the roo script snippit to generate said code:

      {{
      enum type --name ~.domain.Title
      enum constant --name MR --class ~.domain.Title
      enum constant --name MRS --class ~.domain.Title
      enum constant --name MS --class ~.domain.Title
      enum constant --name DR --class ~.domain.Title

      entity --name ~.domain.User --table users --permitReservedWords --testAutomatically
      field enum --fieldName title --type ~.domain.Title --enumType
      }}

      Ideally a warning should be presented when attempting to create the field name (similar to what --permitReservedWords does) or a better id is generated for the parent div#_title element.

      Obviously to fix the problem you simply rename the div#_title and associated theming script

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                sschmidt Stefan Schmidt
                Reporter:
                bjc Benjamin Conlan
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - 1h
                  1h
                  Remaining:
                  Remaining Estimate - 1h
                  1h
                  Logged:
                  Time Spent - Not Specified
                  Not Specified