CA Service Management

  • 1.  Ca Service Catalog - Hide/show field depending od dropdown selection

    Posted Apr 17, 2019 05:45 PM

    Hi all,

     

    I'm trying to configure a form where depending on dropdown selection to show/hide texfields so user can input custom information.

     

    Example:

     

    Dropdown

    - value1 will show field1 and hide field2

    - value2 will show field2 and hide field1

     

    Any help would be helpful.

    Best Regards,

    Domagoj



  • 2.  Re: Ca Service Catalog - Hide/show field depending od dropdown selection
    Best Answer

    Broadcom Employee
    Posted Apr 18, 2019 02:17 AM

    Good Morning Domagoj.

    I found an example, based on a data object query. Perhaps it can get you started?

    CheckRequestHasCost: function(reqId){
    ca_reportQuery('3afcea41214ad-e0bb3db152ac6628c8-6a811454941440449',
    {'req_id':reqId},
    function(rows)
    {
    var cost = rows[0]['has_cost'];
    if(cost == '1'){
    ca_fdSetTextFieldValue(ca_fd.formId, 'has_cost', cost);
    ca_fdShowFields(ca_fd.formId, ['frameEcon', 'attest_userid_locked']);
    else{
    ca_fdSetTextFieldValue(ca_fd.formId, 'has_cost', cost);
    ca_fdHideFields(ca_fd.formId, ['attest_userid', 'frameEcon', 'attest_userid_locked']);
    }
    ca_fd.js.SetRequestMode(reqId);
    },
    ca_fd.js.onFailureFetch);
    },

    Kind regards, Louis.



  • 3.  Re: Ca Service Catalog - Hide/show field depending od dropdown selection

    Broadcom Employee
    Posted Apr 18, 2019 02:30 AM

    Good Morning Domagoj.

    I also found the below:
    ca_fdSelectOption(ca_fd.formId,'SelectControl', 'OptionTwo', 'value2');

    Which could help you too?

    Kind regards, Louis.



  • 4.  Re: Ca Service Catalog - Hide/show field depending od dropdown selection

    Posted Apr 18, 2019 03:37 AM

    Hi Louis,

     

    thanks for your answer.

    So the first selection is ca_sdm_attr_category attribute.

     

    To show/hide TextField1 if value1 is selected ca_fdSelectOption should be added where?

    Can you give me an example?

     

    By default these field should be hidden, right?

    On which element and event I attach function?

     


    Kind Regards,

    Domagoj



  • 5.  Re: Ca Service Catalog - Hide/show field depending od dropdown selection

    Posted Apr 18, 2019 05:14 AM

    I've tested this:

     

    ca_fdHideField('formID', 'fieldID')

    ca_fdShowField('formID', 'fieldID')

     

    working.