The CreatorCon Call for Content is officially open! Get started here.

How to create UI policy on question choices.

Brent Cox
Giga Guru

I have to create a somewhat complex form where I need to use either multiple choice or select box for a number of variables. What I am trying to do is to have only certain question choices available depending on the drop down selection prior to it. Is there any way to use a Catalog UI Policy or anything else to make only certain question choices visible based on the variable chosen before it? Thanks! 

9 REPLIES 9

Hi Brent,

Now, I get it. As you are trying to hide the choice value, you have to use script.

I was under the impression that you are willing to hide the entire variable.

Try using g_form.showOption() and g_form.hideOption() to show and hide question choices. It will work

// Get the HTML elements of the select box variables 
var area = g_form.getControl(‘sap_service_area’);
var workstream = g_form.getControl(‘sap_services_workstream’);

// Define a function to show or hide the HR option based on the area value 
function showHideHR() {
    if (area.value == ‘sap_services_successfactors’) {  // Show the HR option if area is Success Factors 
        g_form.showOption(‘sap_services_workstream’, ‘sap_services_HR’);
    } else { // Hide the HR option if area is not Success Factors 
        g_form.hideOption(‘sap_services_workstream’, ‘sap_services_HR’);
    }
}

You may need to modify it accordingly.

 

Kind Regards,

Swarnadeep Nandy

 

Thank you very much! Apologies for my late response, I was on vacation. I will write this script out tomorrow and test it out. If this works, I will accept solution! 🙂 Once again, many thanks! 

Hello, 

I tried adding this script both to the UI policy section and to the catalog script, but it doesn't seem to be hiding or showing any of the question choices. I will keep modifying to see if I can figure out why. 

SupPra
Tera Contributor

Hi, 

I do have a similar use case. Did you manage to implement this? If so, could you please share the solution.

For the choices the best practice is through client script