catalog

nameisnani
Mega Sage

Hi Team 

 

Can any one please help me here , 

 

We have variable ' company code ' it is mutilple choice

nameisnani_0-1712126108515.png

 

And having 4 values in Company code . 

Example :

00001

00002

00003

00004

 

And we have type of request variable

FGS - KingTone

FGS- mameber 

 

If any user selected type of req is '  FGS - KingTone ' then in the company code '00001' and 00002 has to be populate .

If any user selected type of req is '  FGS- mameber ' then in the company code '00003' and 00004 has to be populate .

 

can any one please provide steps of Cilent script . 

 

Please provide me script .

Thanks in advance 

5 REPLIES 5

Abhijeet_Pawar
Tera Guru

 

Hello @nameisnani 

Could you please provide detailed explanations for the types of variables mentioned below

  1. FGS - KingTone
  2. FGS - membe

Maddysunil
Kilo Sage

@nameisnani 

Don't use multiple choice type for company code, use select box type field. And write onchange client script on type of request variable, below is the code:

 

var typeOfRequest = g_form.getValue('type_of_request');
    var companyCodeField = g_form.getControl('company_code');

    // Hide all options
    var options = companyCodeField.options;
    for (var i = 0; i < options.length; i++) {
        options[i].hidden = true;
    }

    // Show relevant options based on the type of request
    if (typeOfRequest === 'FGS - KingTone') {
        showOption('00001');
        showOption('00002');
    } else if (typeOfRequest === 'FGS- mameber') {
        showOption('00003');
        showOption('00004');
    }

function showOption(value) {
    var option = g_form.getOption('company_code', value);
    if (option)
        option.hidden = false;
}

 

Please Mark Correct if this solves your query and also mark 👍Helpful if you find my response worthy based on the impact.

 

Thanks

Hi @Maddysunil 

 

Client need Mutilple seleect only

@nameisnani 

With multiple choice field you will be able to select only one value out of four choices. So if client requirement is to select multiple choices you can create four checkbox type field(00001, 00002, 00003, 00004) and make company code field as Label type.(see screenshot)

If you can do that then below is the working code:

 

    var typeOfRequest = g_form.getValue('type_of_request');

    g_form.setDisplay('first', false); // first is the backend name of 00001
    g_form.setDisplay('second', false); //second is the backend name of 00002
    g_form.setDisplay('third', false); //third is the backend name of 00003
    g_form.setDisplay('fourth', false); //fourth is the backend name of 00004

    // Show relevant checkboxes based on the type of request
    if (typeOfRequest === 'FGS - KingTone') {
        g_form.setDisplay('first', true);
        g_form.setDisplay('second', true);
    } else if (typeOfRequest === 'FGS- mameber') {
        g_form.setDisplay('third', true);
        g_form.setDisplay('fourth', true);
    }

 

Please Mark Correct if this solves your query and also mark 👍Helpful if you find my response worthy based on the impact.

 

Thanks