Tapestry 5
  1. Tapestry 5
  2. TAP5-200

The Submit component doesn't need validation decoration

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 5.0.15
    • Fix Version/s: 5.0.16
    • Component/s: None
    • Labels:
      None

      Description

      Currently, each form field, including submits, is wrapped with validation decoration. Eg:
      <input id="itemEdit" name="itemEdit" type="submit" value="Edit">
      <img alt="[Error]" class="t-error-icon t-invisible" id="itemEdit:icon" src="/myapp/assets/tapestry/field-error-marker.png">

      Submit should suppress it by eg:
      @Override
      public void beforeDecorator(MarkupWriter writer)
      {
      }

      @Override
      public void afterDecorator(MarkupWriter writer)
      {
      }

      Cheers,
      Nick.

        Activity

        Hide
        Nick Westgate added a comment -

        Here's a patch that adds these overrides to omit decoration.

        NOTE: This means changing 2 method signatures on the AbstractField superclass.
        Methods beforeDecorator and afterDecorator go from final to public.
        It seems reasonable that subclasses would want to override the decoration somehow.

        Cheers,
        Nick.

        Show
        Nick Westgate added a comment - Here's a patch that adds these overrides to omit decoration. NOTE: This means changing 2 method signatures on the AbstractField superclass. Methods beforeDecorator and afterDecorator go from final to public. It seems reasonable that subclasses would want to override the decoration somehow. Cheers, Nick.
        Hide
        Howard M. Lewis Ship added a comment -

        Is this necessary? Is there any harm in the Submit component rendering itself? What if the operation triggered by the Submit is considered a validation failure?

        Show
        Howard M. Lewis Ship added a comment - Is this necessary? Is there any harm in the Submit component rendering itself? What if the operation triggered by the Submit is considered a validation failure?
        Hide
        Nick Westgate added a comment -

        That's a fair question, though it's something I've never wanted/needed to do. Conversely, it is necessary for every submit to include the extra content? If one wants to disable it, there should be a way.

        Cheers,
        Nick.

        Show
        Nick Westgate added a comment - That's a fair question, though it's something I've never wanted/needed to do. Conversely, it is necessary for every submit to include the extra content? If one wants to disable it, there should be a way. Cheers, Nick.
        Hide
        Howard M. Lewis Ship added a comment -

        As part of the fix, the Submit no longer extends from AbstractField, and no longer implements Field. It does still implement ClientId. The ClientId is allocated lazily, as with the link components.

        Show
        Howard M. Lewis Ship added a comment - As part of the fix, the Submit no longer extends from AbstractField, and no longer implements Field. It does still implement ClientId. The ClientId is allocated lazily, as with the link components.

          People

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

            Dates

            • Created:
              Updated:
              Resolved:

              Development