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

  • <script>
    /* var UWStatus = rbf_getPicklistCode("UW_Status");

    if (UWStatus == "CTC - PTF|CTC" || "CTC - UTR|CTCUTR") {
    $("#rbi_branch_pricing_concession").hide();
    $("#rbi_loan_discount_fee").hide();
    } else {
    $("#rbi_branch_pricing_concession").show();
    $("#rbi_loan_discount_fee").show();
    }*/
    </script>

    I've created this condition
    e,g : If the field UW Status =  CTC - PTF|CTC || CTC - UTR|CTCUTR

    hide 2 fields from the page or make the text box readonly....

  • Hello,

    What problem do you see when using this code?

    Regards,

    Karthikeyan

  • Hi,

    Read your code from the start all the way to the end, I'm sure you will see the error.

    Regards

    Charlton Santana

  • Shouldn't this

    if (UWStatus == "CTC - PTF|CTC" || "CTC - UTR|CTCUTR") {

    be

    if ((UWStatus == "CTC - PTF|CTC") || (UWStatus == "CTC - UTR|CTCUTR"))

    -Regards.

  • well I've read it couple of times and Not able to find out where am I going wrong.

    The very same code use to work on the page earlier but not anymore.

    @karthikeyan :  Well there is no error in the page but based on the condition the fields must be invisible in this case its not happening.

    The fields are very much visible even with the conditions match 100%

  • Try this code

    <script>

    var UWStatus = rbf_getPicklistCode("UW_Status");

    if (UWStatus == "CTC - PTF|CTC" || UWStatus == "CTC - UTR|CTCUTR") {

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

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

    } else {

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

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

    }

    </script>

    - See more at: community.progress.com/.../69630.aspx

  • No its not working @Charlton

    Just wondering if I'm missing something in there

  • Can you please add a console log to print the value of UWStatus and its typeof  before the if check as the jquery invocations seem fine?

  • Ok, Well firstly you had /* */ Around your code which comments it out, you may have missed this.

    Maybe try some debugging.

    <script>

    var UWStatus = rbf_getPicklistCode("UW_Status");

    if (UWStatus == "CTC - PTF|CTC" || "CTC - UTR|CTCUTR") {

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

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

         // check your console.

         console.log("This is hiding");

    } else {

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

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

        // check your console.

         console.log("This is Showing");

    }

    </script>

    - See more at: community.progress.com/.../69632.aspx

  • yes  /**/ this comments I have placed it on purpose to post in here

    Well that code doesn't seem to work  or even the log is not posting anything on the screen

    Well Its a view where it use to work on Confirm Status Change option...

    Should we change the script to use ONLOAD or ONBLUR

  • Does anything log using this code?

    var UWStatus = rbf_getPicklistCode("UW_Status");

    console.log("Before IF");

    if (UWStatus == "CTC - PTF|CTC" || "CTC - UTR|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");

    If not, do a check with onBlur="testFunction()"

    function testFunction() {

          console.log("Test function called!");

    }

    - See more at: community.progress.com/.../69637.aspx

  • Grrrrrr....

    i'm sure I'm doing something really crazy it doesn't seem to work

    I don't know how the first code was working before and now it doesn't anymore

    I'm thinking loud.... if this code is it appropriate for this page / view or what ever we might call it

    This page is a simple Confirm Status Change.....

    UW Status - its a Reference fields from different Object

    When user click on Workflow  - Branch Pricing Concession

    The workflow page  shown below must hide 2 fields  

    The code is written under Design Page  

    h
    ere i don't even see a place even to write a script on onblur

    Kindly guide me where am I going wrong

  • Try this: re-arrange your scripts and put it after the UW Status field.

  • Change the condition as:

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

    For a picklist item - CTC - PTF|CTC,

    CTC-PTR is the label

    CTC is the code.

    Hence, you need to check the pickist code only against code values. That is

    rbf_getPicklistCode("UW_Status") will either return:

    CTC

    or

    CTCUTR

    Regards,
    Siraj.
  • Correction

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

    Regards,
    Siraj.