Tapestry
  1. Tapestry
  2. TAPESTRY-1417

CSS classes on text input fields are discarded when field is in error

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 5.0.4
    • Fix Version/s: 5.0.6
    • Component/s: tapestry-core
    • Labels:
      None

      Description

      The TextField, TextArea and PasswordField components (all children of AbstractTextField) accept a "class" attribute as an informal parameter. This is rendered correctly when the component is rendered normally.

      However when the field has a validation error the ValidationDecorator will set class="t-error" before the informal attributes are added. This prevents any user supplied classes being rendered.

      ValidationDecorator works correctly if the class attribute has already been written (it adds t-error it that case), the issue is that the AbstractTextField calls the decorator before the informal attributes are rendered.

      I'm not sure of the best way to ensure the decorator is called after the informal parameters. The options I see are
      a) remove the RenderInformals mixin from AbstractField & call renderInformalParameters explicitly
      -> downside is other children of AbstractField also have to explicitly deal with informal parameters
      b) make class an explicit parameter
      -> downside is that it has to be added to attributes explicitly somewhere
      c) move the validation render & decorate to the BeforeRenderTemplate phase
      -> which feels a bit like a hack

      I think option (a) is probably best.....
      (happy to supply patch for whichever approach)

        Activity

        No work has yet been logged on this issue.

          People

          • Assignee:
            Howard M. Lewis Ship
            Reporter:
            Ben Sommerville
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development