Grails
  1. Grails
  2. GRAILS-6882

Add smart field rendering tags (like bean-fields plugin)

    Details

    • Type: New Feature New Feature
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None

      Description

      The bean-fields plugin (http://grails.org/plugin/bean-fields) provides tags that render input fields smartly, namely doing the following:

      • Rendering HTML <label> for the field with the appropriate attributes, and text from i18n or fallback to convention
      • Rendering fields errors inline by the field
      • Rendering of customizable "required" indicator
      • Customization of the layout of these decorated input fields using a template mechanism, where templates are retained for the duration of the request and can be modified during request processing
      • Rendering fields according to the constraints on the command/domain object, where possible.
      • Smart selection of HTML markup to use based on field type
      • Simple rendering of edit fields for list of properties of an object with one tag

      The plugin is well established and provides the basis for the work but there are some suggestions for improvement when pulling into core:

      • Adapt to use Grails naming conventions for field labels
      • Make it easier to define templates, preferably with named stylings/suites of templates. e.g. an artefact with a simple DSL for defining the GSP fragments, so that a form can specify templateName="standardForm" or similar, and all the field templates will be loaded from that suite. Something like this will improve performance also over using g:render to render common GSP that sets up the templates.
      • Improve performance where currently it delegates to existing grails tags, it may be a lot better to use functions in the grails taglibs and have the regular field tags call these also (rather than multiple tag invocations)
      • Examine retro-fitting this functionality to some or all of the existing field tags, such that when the beanName attribute is specified, it switches to smart behaviour. This would prevent a proliferation of similar tags. I think these tags should be in the "g" namespace, and this would avoid such problems. Most of the bean tags delegate to grails tags anyway so the attributes are largely orthogonal
      • Fix the naming/paradigm for overriding "required indicator" when rendering fields, there is confusion about how to force a field to appear mandatory, and I have never been happy about this requiredField attribute name. Look at adding "required" attribute to override required or not, and "requiredIndicator" to override the default required indicator (note the presence of "constraints" attribute override means you can achieve this currently with dummy constraints)
      • Issues with input field not having a template in the same way as other field types

        Issue Links

          Activity

          No work has yet been logged on this issue.

            People

            • Assignee:
              Marc Palmer
              Reporter:
              Marc Palmer
            • Votes:
              23 Vote for this issue
              Watchers:
              19 Start watching this issue

              Dates

              • Created:
                Updated:
                Last Reviewed:

                Development