multiple choice variable with rich text variables hidden based on answers

nathanscott
Kilo Contributor

Hi,

Hoping you can help and apologies if im posting in the wrong place.

Ive created a catalog item for a system we use that has 3 parts people can log faults with, depending which they choose there is then another multiple choice variable for those 3 choices and these are working as intended.  However ive then created rich text variables with self help information for each choice they make.
Ive created catalog UI policies to only show the rich text variable only for the choice they have made but having issues with this still showing rich text from the first option picked (apologies for my poor explanation, i'll put an example below)


What is your fault with > 
Option 1

Option 2

Option 3

 

Option 1 selected > Option 1 of that multiple choice variable selected >  displays rich text variable for that issue

Option 2 selected > Option 3 of that multiple choice variable displays rich text variable from Option 1, and the rich text variable for Option 3 as well

 

When going back to Option 1, displays rich text variable from Option 2 and from Option 1

2 REPLIES 2

Rajesh Chopade1
Mega Sage

hi @nathanscott 

Create a separate UI Policy for each option in the multiple choice variable:

for Option 1 :

 

  • Show Rich Text Variable for Option 1.
  • Hide Rich Text Variables for Options 2 and 3.

for Option 2 :

 

  • Show Rich Text Variable for Option 2.
  • Hide Rich Text Variables for Options 1 and 3.

 

for Option 3 :

 

  • Show Rich Text Variable for Option 3.
  • Hide Rich Text Variables for Options 1 and 2.

 

If above UI Policy still not worked then use client script:

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

    // Hide all rich text variables first
    g_form.setDisplay('rich_text_option_1', false);
    g_form.setDisplay('rich_text_option_2', false);
    g_form.setDisplay('rich_text_option_3', false);

    // Show the relevant rich text based on the selection
    if (newValue == 'Option 1') {
        g_form.setDisplay('rich_text_option_1', true);
    } else if (newValue == 'Option 2') {
        g_form.setDisplay('rich_text_option_2', true);
    } else if (newValue == 'Option 3') {
        g_form.setDisplay('rich_text_option_3', true);
    }
}

 

i hope my answer helps you to resolve your issue, if yes please mark my answer helpful and correct.

thank you

rajesh

 

 

 

Rohit99
Mega Sage

Hi @nathanscott,
You can write UI policy like,
condition :
Fault type -> is -> option 1
Add Action :
option_1_text -> visible true

Rohit99_2-1726752951924.png

 


Same for :
condition :
Fault type -> is -> option 2
Add Action :
option_2_text -> visible true

condition :
Fault type -> is -> option 3
Add Action :
option_3_text -> visible true


 

Please mark my response as correct and helpful if it helped solved your question.

 

Thanks,

Rohit Suryawanshi