Wicket
  1. Wicket
  2. WICKET-5411

Improve AutoLabels by updating their CSS classes automatically during Ajax requests

    Details

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

      Description

      The problem with auto labels is that once they are rendered the only way to update their `error`/`required` css classes during ajax requests is to update some parent since auto components cannot be targeted directly. however, when dealing with forms we may not necessarily want to repaint components because we may lose state.

      This issue solves the problem by tracking state changes in form components that have auto labels and updating their css classes on all ajax requests.

      disabled by default in 6.13 (to enable override WebApplication#getUpdateAutoLabelsOnAjaxRequests() ), always enabled in 7.0

        Activity

        Hide
        Martin Grigorov added a comment -

        Reopening to improve the problem with tag.put("id", ...) before 6.13

        Show
        Martin Grigorov added a comment - Reopening to improve the problem with tag.put("id", ...) before 6.13
        Hide
        Martin Grigorov added a comment -

        tag.put("id", getLabelIdFor(component)); at
        https://github.com/apache/wicket/blob/master/wicket-core/src/main/java/org/apache/wicket/markup/html/form/AutoLabelResolver.java?source=cc#L302
        causes a lot of
        WARN - ComponentTag - Please use component.setMarkupId(String) to change the tag's 'id' attribute.
        when executing the JS UI tests (start wicket examples and go to http://localhost:8080/js-test/all.html)

        Show
        Martin Grigorov added a comment - tag.put("id", getLabelIdFor(component)); at https://github.com/apache/wicket/blob/master/wicket-core/src/main/java/org/apache/wicket/markup/html/form/AutoLabelResolver.java?source=cc#L302 causes a lot of WARN - ComponentTag - Please use component.setMarkupId(String) to change the tag's 'id' attribute. when executing the JS UI tests (start wicket examples and go to http://localhost:8080/js-test/all.html )
        Hide
        Igor Vaynberg added a comment -

        i wasnt going to close it until i tested it in our app to make sure it works for complex usecases...

        Show
        Igor Vaynberg added a comment - i wasnt going to close it until i tested it in our app to make sure it works for complex usecases...
        Hide
        Martin Grigorov added a comment -

        I've added Wicket.DOM.toggleClass() method that delegates to jQuery.toggleClass, so there is no direct usage of jQuery APIs in the Java code.
        Please test it that it still works as expected.

        Is there something else to be done for this ticket or it can be closed ?

        Show
        Martin Grigorov added a comment - I've added Wicket.DOM.toggleClass() method that delegates to jQuery.toggleClass, so there is no direct usage of jQuery APIs in the Java code. Please test it that it still works as expected. Is there something else to be done for this ticket or it can be closed ?

          People

          • Assignee:
            Igor Vaynberg
            Reporter:
            Igor Vaynberg
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development