Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Set background colour of required formitems?

    Hi,
    We would like required form items to have a yellow background inside the input (so the textfield should be yellow). Is there a way of doing this without setting the basestyle?

    The reason that I don't want to use a different basestyle is that this results in a whole new set of style classes for all the different states and different inputs we have. Or is there another way to flexibly add extra styleclasses to an input without overriding/changing the basestyle?

    gr. Martin

    #2
    There isn't a way to do this without replacing the style series. However note, this is usually better, because if you change the backgroundColor you may well want to tweak the border or text color for better contrast.

    Comment


      #3
      In this case changing the background colour is enough. Is there a way to get multiple style class names into Smartclient components, while still having the state-based styling?

      For example by overriding the getStateName() of a canvas and appending our own custom css style name which just sets the background?
      Is this wish/requirement something you have heard before. It feels like a light weight solution.

      gr. Martin

      Comment


        #4
        This isn't limited to changing the backgroundColor, it changes the whole style. No, an override of getStateName() (NOTE: internal undocumented method) will not allow you to assign multiple styles to one element.

        Comment


          #5
          This is a pity, I have to introduce 30 new styleclasses or so just to get the background coloured yellow for required inputs...

          But maybe I am doing something wrong, for example I now have these style classes:

          .OBFormFieldInput,
          .OBFormFieldInputFocused,
          .OBFormFieldInputError,
          .OBFormFieldInputHint,

          .OBFormFieldSelectInput,
          .OBFormFieldSelectInputError,
          .OBFormFieldSelectInputFocused,
          .OBFormFieldSelectInputHint,

          .OBFormFieldDateInput,
          .OBFormFieldDateInputFocused,
          .OBFormFieldDateInputError,
          .OBFormFieldDateInputHint,

          To get the required field to be coloured yellow I have to introduce an extra style class for each of the above cases (note that there are more styles for other inputs which I did not list here).

          Or do I follow a wrong approach maybe?

          I think many things are great but it seems that allowing multiple style classes for styling sc components would help to streamline the styling effort a lot.

          gr. Martin

          Comment


            #6
            Yes, you need to define those styles. It seems a pretty minor burden for a pretty unusual sort of styling (the most common type of styling for required fields is bold titles or some kind of asterisk). And again, it is usually necessary to define a whole new set of styles in order to obtain a high quality visual appearance, because adjusting the background color often means that the text color should be adjusted as well.

            Comment


              #7
              I don't agree at all.
              It's very common to have required fields in another color in a lot of applications.
              And if you use a ligth yellow as background you have a good visual appearance without further changes...

              Comment


                #8
                You disagree specifically with what? Both ways of styling are straightforwardly achievable, and the availability of per-state styling makes for a high-quality visual appearance.

                Note also, a pale yellow background color isn't as accessible as bold text or other ways of styling a required field which do not rely on color perception.

                Comment

                Working...
                X