Wicket
  1. Wicket
  2. WICKET-5331

Make html5 form validation configurable

    Details

    • Type: Improvement Improvement
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 6.10.0
    • Fix Version/s: 6.11.0, 7.0.0-M1
    • Component/s: None
    • Labels:
      None

      Description

      Due to WICKET-5289, Wicket 6.10.0 adds html5 'required' attributes to all TextArea and TextFields.
      This causes html5 compliant browsers (e.g. Firefox) to display a generic error ('Please fill out this field') on such text fields if left empty.
      Compared to the error messages one can display using wicket's validation infrastructure, this is a rather poor user experience. Since browsers don't submit the form if a html5 validation message is displayed, there's no way to provide a more meaningful error message.
      Unfortunately, there is currently no easy way to disable html5 form validation in a wicket web app. It is now necessary to create subclasses of TextField and TextArea that revert the undesired behavior of those components, which is obviously a lot of work. There should be an easy way to disable the generation of html5 form validation attributes. I would like to propose the introduction of a global setting (maybe in IMarkupSettings or some other I*Settings interface?) that controls the automatic generation of all html5 form validation attributes.

        Issue Links

          Activity

          Hide
          Sven Meier added a comment -

          IMHO this is similar to WICKET-4904:

          As an non-essential functionality of AbstractTextComponent the "required" attribute should be handled by an optional behavior instead.

          The change in WICKET-5289 should be reverted.

          Show
          Sven Meier added a comment - IMHO this is similar to WICKET-4904 : As an non-essential functionality of AbstractTextComponent the "required" attribute should be handled by an optional behavior instead. The change in WICKET-5289 should be reverted.
          Hide
          Jonas added a comment -

          +1 for reverting WICKET-5289 as it even breaks core wicket features (see WICKET-5324 )

          Show
          Jonas added a comment - +1 for reverting WICKET-5289 as it even breaks core wicket features (see WICKET-5324 )
          Hide
          Sven Meier added a comment -

          Example how HTML5 Forms could be handled by an optional behavior.

          Show
          Sven Meier added a comment - Example how HTML5 Forms could be handled by an optional behavior.
          Hide
          Martin Grigorov added a comment -

          I like the proposed behavior!
          I'd move each part of onComponentTag() body into its own protected method so the user can override something if she doesn't like the default.

          Show
          Martin Grigorov added a comment - I like the proposed behavior! I'd move each part of onComponentTag() body into its own protected method so the user can override something if she doesn't like the default.
          Hide
          Sven Meier added a comment -

          HTML5 attributes are optional now with Html5Attributes behavior

          Show
          Sven Meier added a comment - HTML5 attributes are optional now with Html5Attributes behavior

            People

            • Assignee:
              Sven Meier
              Reporter:
              Ulrike M
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development