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

CRF: value filled in based on the value of another field

See image: one field should have a value based on the value in another field.
I tried to do this with a script in the sections worksheet (cfr https://www.openclinica.com/forums#/discussion/comment/16250) but it's not working. I have no idea why not.
see Excel template attached.image

Comments

  • GerbenRienkGerbenRienk Posts: 827 ✭✭✭
    In your script you use a variable with name "class" which is a reserved word. Ichanged that to TIQClass. Furthermore you can call the Classification function on the keyup event of TotIQ, because that is the only item you have to watch.

    <script src="includes/jmesa/jquery.min.js"></script> 
    <script lang="Javascript">
    $.noConflict();
    jQuery(document).ready(function($){ 
    var totField = $("#TotIQ").parent().parent().find("input");
    var TIQClassField = $("#TotClass").parent().parent().find("input");
    TIQClassField.attr("readonly", true);
    function TIQClassification(){
    var tot = totField.val();
    var TIQClass = "";
    var curClass = TIQClassField.val();
    if(tot<85){
    TIQClass ="zwakbegaafd";
    }
    if(tot>=85 && tot<100){
    TIQClass ="benedengemiddeld begaafd";
    }
    if(tot>=100 && tot<115){
    TIQClass ="gemiddeld begaafd";
    }
    if(tot>=115 && tot<135){
    TIQClass ="bovengemiddeld begaafd";
    }
    if(tot>135){
    TIQClass ="hoogbegaafd";
    }
    if(curClass!==TIQClass){
    TIQClassField.val(TIQClass);
    TIQClassField.change();
    }
    totField.keyup(function(){
    TIQClassification();
    });
    });
    </script> 
  • wwiers0wwiers0 Posts: 18
    This is really great! Thank you very much!!!
This discussion has been closed.