Show or hide field HELP! - Forum - Rollbase - Progress Community

Show or hide field HELP!

 Forum

Show or hide field HELP!

This question is answered

Hers is my script

<script>

function SorHEmploy()
{
var code = rbf_getPicklistCode("{!Has_Pension_Income#value}");
rbf_showOrHideField('Monthly_Income_Pension' , code=="Yes") , true,)
}
</script>

Its Onload and OnChange

But Debug gives this error

Any ideas/suggestions please?

Thanks

Verified Answer
All Replies
  • Hi,

    I am guessing you are using NewUI. If so as per doc rbf_showOrHideField() method takes three arguments. First one is fieldName , second argument is true/false decides whether to show Field or not, third argument is true/false decides HideResponsiveColumn or not.

    So your code should be

    var code = rbf_getPicklistCode(fieldName); //Pass the field integration name of your picklist field

    //Show Monthly Income Pension field if code is "Yes" otherwise hide it

    rbf_showOrHideField("Monthly_Income_Pension", (code==='Yes'),true);

    There is a syntax error at your code in the second line, there is extra comma at the end and close parenthesis missing.

    Let me know if this works.

    Thanks,

    Vimal

  • Got to hear now...still throwing up an error....see cut and paste from debugger...

    001 <script>

    002  

    003     function SorHEmploy()

    004 {

    005   var code = rbf_getPicklistCode("Has_Pension_Income");

    006

    007 //Show Monthly Income Pension field if code is "Yes" otherwise hide it

    008

    009 rbf_showOrHideField("Monthly_Income_Pension", code=='Yes', true);

    010 }

    011 </script>

    ------------------------------------------------------------------------

    Formula return type: String

    Error

    Syntax Error (line #5) in formula:

    <script>

       function SorHEmploy()

    {

     var code = rbf_getPicklistCode("Has_Pension_Income");

    //Show Monthly Income Pension field if code is "Yes" otherwise hide it

    rbf_showOrHideField("Monthly_Income_Pension", code=='Yes', true);

    }

    </script>

  • Hi,

    Can you add a template field with above script and include this template field in required pages?.. Then you can invoke this method from wherever you need in the included pages.

    As your code is static function you don't require to add formula field and also when you add a formula field you need to make sure entire script is escaped with codes that is you need to return them as string including <script> tag.

    Hope this help,

    Vimal.

  • HELP HELp HELP - This should be easy but is so frustrating....

    I have now tried this - but it is still not worjking

    Does this function work on a NEW PAGE?

    ---------------------------------------

    <script>

     // Hide or Show 'Monthly Income - Pension' field

     function SorHEmploy()

    {

     if ('{!Has_Pension_Income#value}' == 'Yes')

     {

             rbf_showOrHideField("Monthly_Income_Pension", true, true);

     }

    else

     {

              rbf_showOrHideField("Monthly_Income_Pension", false, true);

     }

    }

    </script>

  • Hi ionacaerex,

    You are mixing server-side API and browser-side API.

    If I'm not wrong, the first screenshot was taken when you were trying to debug your trigger, right?

    When writing triggers, you should not use <script> tag .... and rbf_* are browser-side APIs.

  • What do you recommend I use? I am non technical and very confused now :(

  • Please log a support ticket and we can go though your APP and check it out.

  • Thanks Ricardo - much appreciated and will log it now.

  • Thnaks Ricardo - logged as case ref : 00390305

  • Thanks Ricardo - logged as case ref : 00390305

  • Hi ionacaerex,

    When you have a chance, please check your support case comments.

  • Hi Ricard - are you suggesting a quick call - I am in thye Uk and free most of this pm if so.

    Many Thanks

  • Hi ionacaerex,

    When you have a chance, please check your support case comments.

  • Ricardo - any chance we can follow up on this please? Much apprecieted.

    Thanks

  • Hi ionacaerex,

    Definitely... I just need your feedback through the support case.