Questions related to prior choice value not disappearing when new choice is selected

Saquib Mohammed
Mega Guru

I have a scenario like this. 
Choice List 1 -> Outlook, Teams, etc

Choice List 2 (for outlook) -> choice1, choice2

Choice List 3 (for Teams) -> choiceA, choice B

When I select the different choices within the first level of choice list, e.g. If i switch between choice1 and choice2, the questions appear and hide the way they shoudl

When I select different choices on the first level of choice list, e.g. If I switch between Outlook and Team, then the questions from the previous selection do not disappear.

will I need to write a onChange client script and reload the form when election from first level of choice list changes? 

1 ACCEPTED SOLUTION

Amit Verma
Kilo Patron
Kilo Patron

Hi @Saquib Mohammed 

 

Have a look on the below example, you might be able to figure out the issue :

 

1. I have two variables, one for Tools with choices as Outlook and Teams and another for functionalities being offered by these tools where we will populate the choices dynamically based on the selection of tool.

AmitVerma_0-1716866848637.png

 

2. To populate the functionality choices, I have an On-Change Catalog Client Script being configured which will populate the choices based on change of tool. Observe that I am clearing the field options each time before populating the choices :

 

AmitVerma_1-1716866994288.png

 

function onChange(control, oldValue, newValue, isLoading) {
   if (isLoading || newValue == '') {
      return;
   }
   g_form.clearOptions('function');
   if(newValue == 'outlook'){
	g_form.addOption('function','email','Email');
	g_form.addOption('function','meeting','Meeting');
   }
   else if(newValue == 'teams'){
	g_form.addOption('function','call','Call');
	g_form.addOption('function','chat','Chat');

   }
}

 

Result :

 

AmitVerma_2-1716867081659.png

 

AmitVerma_3-1716867104179.png

 

AmitVerma_4-1716867119495.png

 

Thanks and Regards

Amit Verma


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

View solution in original post

6 REPLIES 6

It’s not just one question. There are many for different choice selections. I will have to code to hide each of them. Easier to load the form since it is required only when the top level choice value changes. What do you think?  

Amit Verma
Kilo Patron
Kilo Patron

Hi @Saquib Mohammed 

 

Have a look on the below example, you might be able to figure out the issue :

 

1. I have two variables, one for Tools with choices as Outlook and Teams and another for functionalities being offered by these tools where we will populate the choices dynamically based on the selection of tool.

AmitVerma_0-1716866848637.png

 

2. To populate the functionality choices, I have an On-Change Catalog Client Script being configured which will populate the choices based on change of tool. Observe that I am clearing the field options each time before populating the choices :

 

AmitVerma_1-1716866994288.png

 

function onChange(control, oldValue, newValue, isLoading) {
   if (isLoading || newValue == '') {
      return;
   }
   g_form.clearOptions('function');
   if(newValue == 'outlook'){
	g_form.addOption('function','email','Email');
	g_form.addOption('function','meeting','Meeting');
   }
   else if(newValue == 'teams'){
	g_form.addOption('function','call','Call');
	g_form.addOption('function','chat','Chat');

   }
}

 

Result :

 

AmitVerma_2-1716867081659.png

 

AmitVerma_3-1716867104179.png

 

AmitVerma_4-1716867119495.png

 

Thanks and Regards

Amit Verma


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