1. Tapestry
  2. TAPESTRY-1417

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


    • 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:


      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)


        Ben Sommerville created issue -
        Ben Sommerville made changes -
        Field Original Value New Value
        Affects Version/s 5.0.4 [ 12312381 ]
        Fix Version/s 5.0.4 [ 12312381 ]
        Howard M. Lewis Ship made changes -
        Fix Version/s 5.0.6 [ 12312544 ]
        Assignee Howard M. Lewis Ship [ hlship ]
        Resolution Fixed [ 1 ]
        Status Open [ 1 ] Closed [ 6 ]
        Mark Thomas made changes -
        Workflow jira [ 12402054 ] Default workflow, editable Closed status [ 12569178 ]
        Mark Thomas made changes -
        Workflow Default workflow, editable Closed status [ 12569178 ] jira [ 12590437 ]


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


            • Created: