This discussion is archived
1 2 Previous Next 16 Replies Latest reply: Dec 3, 2012 3:00 PM by Martin1 Go to original post RSS
  • 15. Re: LOV change background colour
    fac586 Guru
    Currently Being Moderated
    Martin1 wrote:

    'works ... without focus' - I mean that if i switch off the focus on item at that page it works, but if the item because it's the first of the page is focussed, then it doesn't work.
    It's an essential usability and accessibility feature that users know which control has focus. For this reason it's better to use the browser default settings that they are familiar with. I'd either leave the item without initial focus, or use a different approach to highlight the LOV value.
    With IE 8 the background color is set in the values of the select list and also after selection and page reload in the item.
    With Firefox 17 and Safari 6 the background color is set in the values of the select list and is not set after selection and page reload in the item.
    The class names must match the actual LOV values (i.e. values in the second column in the LOV query):

    Execute when Page Loads:
    $('#P10_STATUS_MIT_MEASURES').change(function() {
      $(this)
        .removeClass('opt-50 opt-51 opt-52')
        .addClass('opt-' + $(this).find('option:selected').val());
    }).change();
    CSS Inline:
    #P10_STATUS_MIT_MEASURES.opt-50,
    #P10_STATUS_MIT_MEASURES option[value="50"] {
      background-color: #99CC00;
    }
    #P10_STATUS_MIT_MEASURES.opt-51,
    #P10_STATUS_MIT_MEASURES option[value="51"] {
      background-color: #FFCC00;
    }
    #P10_STATUS_MIT_MEASURES.opt-52,
    #P10_STATUS_MIT_MEASURES option[value="52"] {
      background-color: #CC0000;
    }
  • 16. Re: LOV change background colour
    Martin1 Newbie
    Currently Being Moderated
    It works now perfectly in all three browsers :-)

    Thanks a lot

    Regards,
    Martin
1 2 Previous Next

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points