We hope you'll join us for our 4/23 webinar on using data tables to apply reference ranges and AE codes in OC4. For more information and to register, visit https://register.gotowebinar.com/register/2882170018956684555

Quick question on CRF settings

2»

Comments

  • lindsay.stevenslindsay.stevens Posts: 404 ✭✭✭
    via Email
    The hide function is supposed to pretty much set display:none, but save
    state. It has sometimes not worked for me either. So you can use CSS
    property as you described and in the jquery docs. The other way I have done
    it is make a CSS class called "hidden" with display: none and use the
    addClass method.

    http://api.jquery.com/hide/
  • lindsay.stevenslindsay.stevens Posts: 404 ✭✭✭
    via Email
    The selector to use then is probably

    $(".aka_err_message").find("label")

    Because you want to hide the individual labels, except for the first one.
  • RCHENURCHENU Posts: 207 ✭✭
    var showerrors = $(".aka_err_message");
    showerrors.css( "display", "none" );


    This works well, no more warnings at all. But can you tell me again how not to hide the first one ?
  • RCHENURCHENU Posts: 207 ✭✭
    Lindsay,

    Eventually, I'm just doing this and it is working:

    $('ul li').hide().filter(':lt(2)').show();

    Can you tell me if it's ok like this ? Do you know how to specify to do it only for .aka_err_message or I can let it like this (ul and li are just use for these warnings message I think).

    thanks a lot,

    Romain.

  • GerbenRienkGerbenRienk Posts: 837 ✭✭✭
    I think you should be very carefull with this approach, because the errorMessagesContainer is used for both the failed-validation-messages and the show/hide-action-messages. In fact the only distinction is in the color-attribute of the li-element. Therefore when you suppress all but one show/hide-action-messages, you will also suppres all but one failed-validation-messages.
    (However the code is wonderfully compact: nice work!)
  • RCHENURCHENU Posts: 207 ✭✭
    Yes you are right.

    Is there a way to execute my query only once (the first time) ? Or do you see a "if" statement that could fit ?

    If nothing comes up, I'll set my maximum to something like 20 !

    Thank you,

    Romain.


  • lindsay.stevenslindsay.stevens Posts: 404 ✭✭✭
    via Email
    I just tested this on the demo 3.4 instance and it works.

    var show_messages = jQuery(".aka_err_message").find("li[style*='#006633'],
    li[style*='rgb(0, 102, 51)']");
    show_messages.hide();
    show_messages.first().show();

    So what this does is get the list items that are in the error messages div,
    but only those with the special green colour that show (and hide?) messages
    get (thanks Gerben).

    There's a hex and rgb style contains selector because when jquery applies a
    display: none, it thinks its being helpful and converts the hex to rgb.
  • RCHENURCHENU Posts: 207 ✭✭
    via Email
    Thank you Lindsay. It
  • RCHENURCHENU Posts: 207 ✭✭
    Thank you Lindsay, it works like a charm !
    Gerben, is that ok for you ?

    Thanks a lot,

    Romain.
  • GerbenRienkGerbenRienk Posts: 837 ✭✭✭
    Yep, I think this is a mighty fine solution ;-)
This discussion has been closed.