Hiding a fields based on Pick list conditions - Forum - Rollbase - Progress Community

Hiding a fields based on Pick list conditions

 Forum

Hiding a fields based on Pick list conditions

  • Well I've tried that already... and also with new code I've tried shifting it after "UW Status" field .

    Even placed the code under properties of the page ONBLUR  / ON SUBMIT  -  NOTHING HAPPENS

    so I'm trying the same code under the design section and also under properties hoping that works, but its a pure LET DOWN scenario  

  • @msiraj

    Well this is the latest code which I've updated and still see no results

    integration name for UW Status is uw_status

    <script>
    var UWStatus = rbf_getPicklistCode("uw_status");

    console.log("Before IF");

    if (UWStatus == "CTC" || UWStatus == "CTCUTR") {

    $("#rbi_branch_pricing_concession").hide();

    $("#rbi_loan_discount_fee").hide();

    console.log("This is hiding");

    } else {

    $("#rbi_branch_pricing_concession").show();

    $("#rbi_loan_discount_fee").show();

    console.log("This is Showing");

    }

    console.log("After IF");

    }
    </script>

  • Please follow the below instructions as is:

    In Design the page, add custom script component after UW_Status field. You can drag and drop it there.

    Edit Script Component and REPLACE code snippet with the following one, without any further modifications:

    <script>

    var debugMsg = function (msg) {

     console ? console.log(msg) :  alert(msg);

    };

    var UWStatus = rbf_getPicklistCode('uw_status');

    debugMsg('UW Satus -' + UWStatus);

    if (UWStatus == 'CTC' || UWStatus == 'CTCUTR') {

     $('#rbi_branch_pricing_concession').hide();

     $('#rbi_loan_discount_fee').hide();

     debugMsg('This is hiding');

    } else {

     $('#rbi_branch_pricing_concession').show();

     $('#rbi_loan_discount_fee').show();

     debugMsg('This is Showing');

    }

    </script>

    Next on Object Edit page, press f12 and look for console messages.

    Regards,
    Siraj.
  • Please review the script below. In order to successfully hide/show a field you need hide and show both the "label" (L) and the "field" (F). This is how I hide/show when I want to include this functionality.

    <script>

    var debugMsg = function (msg) {

    console ? console.log(msg) :  alert(msg);

    };

    var UWStatus = rbf_getPicklistCode('uw_status');

    debugMsg('UW Satus -' + UWStatus);

    if (UWStatus == 'CTC' || UWStatus == 'CTCUTR') {

    $('#rbi_F_branch_pricing_concession').hide();

    $('#rbi_L_branch_pricing_concession').hide();

    $('#rbi_F_loan_discount_fee').hide();

    $('#rbi_L_loan_discount_fee').hide();

    debugMsg('This is hiding');

    } else if (UWStatus != 'CTC' || UWStatus != 'CTCUTR') {

    $('#rbi_F_branch_pricing_concession').show();

    $('#rbi_L_branch_pricing_concession').show();

    $('#rbi_F_loan_discount_fee').show();

    $('#rbi_L_loan_discount_fee').show();

    debugMsg('This is Showing');

    }

    </script>

  • @msiraj - Well I did the same thing what ever you've mentioned step by step

    Next on Object Edit page, press f12 and look for console messages.  - well this part I'm not able to see  which location are you mentioning

    and the script seems not to function :(

  • On 'Status Change' page, it will be logging messages onto browser console. Browser console is not visible by default. To see it you will have to press F12 key.

    Else, if you are still not able to see debug messages,

    Change the first few stamtents in the code as:

    var debugMsg = function (msg) {

    alert(msg);

    };

    And then on your Status Change page, you will see alert boxes.

    Regards,
    Siraj.
  • @msiraj - all i would see in the browser console is that

    UW Satus -null

    main.jsp:2864 This is Showing

  • Now that explains why the condition fails always.

    rbf_getPicklistCode('uw_status'); is returning null.

    Good part however is that you are configuring the script component correctly. It is executing on Status Change page.

    Please carry out these Checks:

    1. uw_status is the correct field integration name.

    2. Field type for this field is either PicklistList or RadioButton.

    3. In Field definition page, field values should be adefined as given below:

    That is:

    CTC - PTF|CTC

    CTC - UTR|CTCUTR

    4. The field is not marked as read-only on edit / status change page.

    Regards,

    Siraj.

    Regards,
    Siraj.
  • On reviewing your earlier post, have noticed that field UW Status is marked as Read Only for status change page.

    Thus, rbf_getPicklistCode returns NULL.

    Regards,
    Siraj.
  • Siraj

    well UW_status is a reference picklist field coming from other object.

    and yes I've cross checked all of them

    CTC - PTF|CTC

    CTC - UTR|CTCUTR

    so is there a way to pull the information based on the condition?

  • Is there a way to pass the way of Read Only field to some sort of hidden field whereby we can reference it?

  • Ok. There is a work around  to make it work.

    First, in UW Status field definition page, mark the field as editable on edit pages:

    Second, in Status Change page script component::

    Call rbf_getPicklistCode with integration name of picklist field in Related object.

    That is, instead of rbf_getPicklistCode("UW_Status"); 

    Modify it as rbf_getPicklistCode("{integration name of picklist field in Related object}");

    Regards,
    Siraj.