Dependent value doesn't work in catalog ?

angel kumari
Tera Contributor

Hi Every body,

I am not get answer  after   ,Could any one help out what is error.

function onChange(control, oldValue, newValue, isLoading) {
   if (isLoading || newValue == '') {
      return;
   }

   //Type appropriate comment here, and begin script below
   if (newValue =='Ad-Hoc Request')
{
    g_form.clearOptions('category');
        g_form.addOption('category', '', '-- None --');
         g_form.addOption('category', 'RFx Project Mapping/Upload', 'RFx Project Mapping/Upload');
        g_form.addOption('category', 'Export/Format RFx', 'Export/Format RFx');
        g_form.addOption('category', 'Request for Response', 'Request for Response');
        g_form.addOption('category', 'Financial Statement Request', 'Financial Statement Request');
        g_form.addOption('category', 'Upload QAs in Content Library', 'Upload QAs in Content Library');
        g_form.addOption('category', 'User Action', 'User Action');
        g_form.addOption('category', 'User Trainning', 'User Trainning');
}
else if (newValue =='Content Management')
    {
     g_form.clearOptions('category');
    g_form.addOption('category', '', '-- None --');
    g_form.addOption('category', 'Upload QAs in Content Library', 'Upload QAs in Content Library');
            }

            else if (newValue =='RFx Project')
            {
                 g_form.clearOptions('category');
                 g_form.addOption('category', '', '-- None --');
                  g_form.addOption('category', 'RFx Project Mapping/Upload', 'RFx Project Mapping/Upload');
        g_form.addOption('category', 'Export/Format RFx', 'Export/Format RFx');
       
            }
            else if (newValue =='Request for Response')
            {
                 g_form.clearOptions('category');
                 g_form.addOption('category', '', '-- None --');
                 g_form.addOption('category', 'Request for Response', 'Request for Response');
                 g_form.addOption('category', 'Financial Statement Request', 'Financial Statement Request');  
            }

            else if (newValue =='User Management')
            {
                 g_form.clearOptions('category');
                 g_form.addOption('category', '', '-- None --');
        g_form.addOption('category', 'User Action', 'User Action');
        g_form.addOption('category', 'User Trainning', 'User Trainning');
            }

           
}
So plz any can find the error.



           
           


 

1 ACCEPTED SOLUTION

Seraj
Tera Guru

Hi @angel kumari 

 

I have tested your script in my instance and i haven't get any error in that even it's working fine.

Try this script again

and make sure the name of your request type choice option value should be correct and avoid spacing in the name.

function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
      return;
   }

   //Type appropriate comment here, and begin script below
   if (newValue =='induiry/help') //request type choice value
{
    g_form.clearOptions('category');
        g_form.addOption('category', '', '-- None --');
         g_form.addOption('category', 'RFx Project Mapping/Upload', 'RFx Project Mapping/Upload');
        g_form.addOption('category', 'Export/Format RFx', 'Export/Format RFx');
        g_form.addOption('category', 'Request for Response', 'Request for Response');
        g_form.addOption('category', 'Financial Statement Request', 'Financial Statement Request');
        g_form.addOption('category', 'Upload QAs in Content Library', 'Upload QAs in Content Library');
        g_form.addOption('category', 'User Action', 'User Action');
        g_form.addOption('category', 'User Trainning', 'User Trainning');
}
else if (newValue =='software test')
    {
     g_form.clearOptions('category');
    g_form.addOption('category', '', '-- None --');
    g_form.addOption('category', 'Upload QAs in Content Library', 'Upload QAs in Content Library');
            }

            else if (newValue =='hardware')
            {
                 g_form.clearOptions('category');
                 g_form.addOption('category', '', '-- None --');
                  g_form.addOption('category', 'RFx Project Mapping/Upload', 'RFx Project Mapping/Upload');
        g_form.addOption('category', 'Export/Format RFx', 'Export/Format RFx');
       
            }
            else if (newValue =='network')
            {
                 g_form.clearOptions('category');
                 g_form.addOption('category', '', '-- None --');
                 g_form.addOption('category', 'Request for Response', 'Request for Response');
                 g_form.addOption('category', 'Financial Statement Request', 'Financial Statement Request');  
            }

            else if (newValue =='database')
            {
                 g_form.clearOptions('category');
                 g_form.addOption('category', '', '-- None --');
        g_form.addOption('category', 'User Action', 'User Action');
        g_form.addOption('category', 'User Trainning', 'User Trainning');
            }

           
}

 

See the attachement

 

Thanks and regards

View solution in original post

11 REPLIES 11

Hi Amit but in catalog  form only 2 value avilable 

1.select box

2.lookup select box

Amit Verma
Kilo Patron
Kilo Patron

@angel kumari 

 

Is the category field a lookup select box ?

 

Thanks and Regards

Amit Verma


Please mark this response as correct and helpful if it assisted you with your question.

Seraj
Tera Guru

Hi @angel kumari 

 

I have tested your script in my instance and i haven't get any error in that even it's working fine.

Try this script again

and make sure the name of your request type choice option value should be correct and avoid spacing in the name.

function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
      return;
   }

   //Type appropriate comment here, and begin script below
   if (newValue =='induiry/help') //request type choice value
{
    g_form.clearOptions('category');
        g_form.addOption('category', '', '-- None --');
         g_form.addOption('category', 'RFx Project Mapping/Upload', 'RFx Project Mapping/Upload');
        g_form.addOption('category', 'Export/Format RFx', 'Export/Format RFx');
        g_form.addOption('category', 'Request for Response', 'Request for Response');
        g_form.addOption('category', 'Financial Statement Request', 'Financial Statement Request');
        g_form.addOption('category', 'Upload QAs in Content Library', 'Upload QAs in Content Library');
        g_form.addOption('category', 'User Action', 'User Action');
        g_form.addOption('category', 'User Trainning', 'User Trainning');
}
else if (newValue =='software test')
    {
     g_form.clearOptions('category');
    g_form.addOption('category', '', '-- None --');
    g_form.addOption('category', 'Upload QAs in Content Library', 'Upload QAs in Content Library');
            }

            else if (newValue =='hardware')
            {
                 g_form.clearOptions('category');
                 g_form.addOption('category', '', '-- None --');
                  g_form.addOption('category', 'RFx Project Mapping/Upload', 'RFx Project Mapping/Upload');
        g_form.addOption('category', 'Export/Format RFx', 'Export/Format RFx');
       
            }
            else if (newValue =='network')
            {
                 g_form.clearOptions('category');
                 g_form.addOption('category', '', '-- None --');
                 g_form.addOption('category', 'Request for Response', 'Request for Response');
                 g_form.addOption('category', 'Financial Statement Request', 'Financial Statement Request');  
            }

            else if (newValue =='database')
            {
                 g_form.clearOptions('category');
                 g_form.addOption('category', '', '-- None --');
        g_form.addOption('category', 'User Action', 'User Action');
        g_form.addOption('category', 'User Trainning', 'User Trainning');
            }

           
}

 

See the attachement

 

Thanks and regards

Hi @angel kumari 

instead of using lookup select box use only select box for the category field.

Then try your script

 

Thanks & Regards

Seraj

Ravindra Yadav
Tera Contributor

Hi @angel kumari ,
Your Script is looking good and it will run only when you change the value of request type because this is an onChange client script.
If you want to execute this logic on load as well you will have to remove the below if block then it will run on load as well as on change also

 if (isLoading || newValue == '') {
      return;
   }