Please join your peers on either March 26 (8pm GMT) or March 28 (8am GMT) to watch as user extraordinaire and forum legend @"lindsay.stevens" demonstrates OpenClinica Insight.

See preview and register at https://openclinica.com/insight-webinar

Insight makes it easy to ask questions of ALL of your clinical and operational data and visualize answers via interactive reports and dashboards. The idea is simple, but the results are powerful: ask your questions, choose your visualizations, then return often for updated, interactive results that link you to all of the underlying data.

warnings and messages in the CRF

Hi,
I found on Trial data solutions how to create a message ( to appear if one of the radios were selected but I'm not managing to apply it to a single-select field. I want a warning to appear if 'no' was selected (from a single select menu) for a Inc criteria (that is put in the Right Items text). Can anyone help me?

Comments

  • haenselhaensel Posts: 570 ✭✭
    Hi
    It might help if you post your current (not working) solution.

    Regards,
    Christian
  • haenselhaensel Posts: 570 ✭✭
    edited November 2017
    In general a single-select field should be handled similar to a text-field. You can get the current value using


    var selectList = ("#SomeID").parent().parent().find("input");
    var selectedValue = selectList.val();


    The selectedValue is the value from the option value attribute.

    <select id='selectID'> <option value="" selected="" style="">Select</option> <option value="1" style="">Text1</option> <option value="2" style="">Text2</option> <option value="3" style="">Text3</option> <option value="4" style="">Text4</option> </select>
  • Michelle_DMichelle_D Posts: 93


    I found this for Text fields:
     

    // for OC versions before 3.1.4, use jquery-1.3.2.min.js !

    $.noConflict();
    jQuery(document).ready(function($) {
    var fieldToCheck = $("#MessageDiv").parent().parent().find("input");

    function setMessage(){
    var valueToCheck = fieldToCheck.val();
    if (valueToCheck && (valueToCheck > 5 || valueToCheck < 2)){
    $("#MessageDiv").html("Normal range is between 2 and 5!");
    }
    else {
    $("#MessageDiv").html("");
    };
    };
    fieldToCheck.keyup(function(){
    setMessage();
    });
    setMessage();
    })


    it didn't work on single select. Perhaps I have to write something else instead of "fieldToCheck'
  • GerbenRienkGerbenRienk Posts: 772 ✭✭✭
    Hi Michelle,
    The type of a single-select is in fact "select" ;-)
    So you can change $("#MessageDiv").parent().parent().find("input") into
    $("#MessageDiv").parent().parent().find("select")
    Kind regards,
    Gerben Rienk
  • Michelle_DMichelle_D Posts: 93
    Hi,thanks for that, but I obviously still have to change something.
    this is what I have:
     

    // for OC versions before 3.1.4, use jquery-1.3.2.min.js !

    $.noConflict();
    jQuery(document).ready(function($) {
    var fieldToCheck = $("#MessageDiv").parent().parent().find("select");

    function setMessage(){
    var valueToCheck = fieldToCheck.val();
    if (valueToCheck && (valueToCheck = 0)){
    $("#MessageDiv").html("Please note that at least ONE question (either A or B) MUST be ‘Yes’ for study eligibility.");
    }
    else {
    $("#MessageDiv").html("");
    };
    };
    fieldToCheck.keyup(function(){
    setMessage();
    });
    setMessage();
    })



    maybe I shouldn't be writing 'fieldToCheck'.
  • Michelle_DMichelle_D Posts: 93
    the smiley that came up should be a B!
Sign In or Register to comment.