Uploaded image for project: 'Click'
  1. Click
  2. CLK-233

Double "class" attributes are rendered in HTML for Field controls if validation is failed.

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None

      Description

      If a Field control, such as TextField, is failed on server-side validation and you also assign a class selector to it, double "class" attributes will be rendered in HTML. Like this: class="myClass" class="error". In Firefox, first "class" wins, so "error" style will not be applied to your Field control.

        Activity

        Hide
        medgar Malcolm Edgar added a comment -

        Thanks for picking this up. The question now is what is the correct behaviour, rendering the "error" class or the user defined class "myClass". In this case I think the former is the correct behaviour, rendering the "error" class when there is a validation error.

        regards Malcolm Edgar

        Show
        medgar Malcolm Edgar added a comment - Thanks for picking this up. The question now is what is the correct behaviour, rendering the "error" class or the user defined class "myClass". In this case I think the former is the correct behaviour, rendering the "error" class when there is a validation error. regards Malcolm Edgar
        Hide
        sabob Bob Schellink added a comment -

        Hi Malcolm

        I think the correct behavior would be to render both classes for example

        <control class="myClass error"/>

        I think most browsers understand this syntax and would apply both styles.

        In the toString() methods we just need to render all "class" attributes together as one.

        kind regards

        bob

        Show
        sabob Bob Schellink added a comment - Hi Malcolm I think the correct behavior would be to render both classes for example <control class="myClass error"/> I think most browsers understand this syntax and would apply both styles. In the toString() methods we just need to render all "class" attributes together as one. kind regards bob
        Hide
        medgar Malcolm Edgar added a comment -

        Hi Bob,

        Your solution sounds good, would you mind if I assign this issue to you?

        regards Malcolm

        Show
        medgar Malcolm Edgar added a comment - Hi Bob, Your solution sounds good, would you mind if I assign this issue to you? regards Malcolm
        Hide
        sabob Bob Schellink added a comment -

        Attached is patch for AbstractControl, adding the methods addStyleClass and removeStyleClass for manipulating class attributes. addStyleClass and removeStyleClass is the method names used by JSF as well.

        The TextField.java.patch updates the TextField to use the new methods addStyleClass and removeStyleClass.

        The AttributeTest.java.patch tests that the new methods work as expected.

        Show
        sabob Bob Schellink added a comment - Attached is patch for AbstractControl, adding the methods addStyleClass and removeStyleClass for manipulating class attributes. addStyleClass and removeStyleClass is the method names used by JSF as well. The TextField.java.patch updates the TextField to use the new methods addStyleClass and removeStyleClass. The AttributeTest.java.patch tests that the new methods work as expected.
        Hide
        sabob Bob Schellink added a comment -

        If the patched are accepted, I will update the other controls to the new attribute methods.

        Show
        sabob Bob Schellink added a comment - If the patched are accepted, I will update the other controls to the new attribute methods.
        Hide
        medgar Malcolm Edgar added a comment -

        Patches applied. Will be available in release 1.4RC2

        many thanks Malcolm

        Show
        medgar Malcolm Edgar added a comment - Patches applied. Will be available in release 1.4RC2 many thanks Malcolm

          People

          • Assignee:
            sabob Bob Schellink
            Reporter:
            shuo2002 Shuo Geng
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development