Visibility of UI Builder based on the radio button selection

KalyaniShaha17
Tera Contributor

Hello All,

 

I want to hide some components in UI builder, based on the selection of radio button options.

If option A is selected, some components should get hide and some should be get displayed.

Please suggest your ideas.

Thanks in advance.

 

 

 

Regards,

Kalyani Shaha

1 ACCEPTED SOLUTION

JagjeetSingh
Kilo Sage

Okay here is how you can do it. In UIB you get events which are triggered by components. Radio button component also triggers an event which you can use.

 

1. Create a state parameter to store the value selected in radio button. Lets call it selectedVal.

2. Go to the radio button events and add an event handler for event "Radio buttons value set". Follow steps shown below.

 

JagjeetSingh_0-1680358168462.png

 

3. Now, go to the container or component you want to show/hide based on this value.

4. Click on the hide component property and bind the value like below. Here you are hiding the component if the value equals to thisValue. Change it as per your need.

JagjeetSingh_1-1680358386769.png

 

 

Thats it!

 

 

Jagjeet Singh
ServiceNow Community Rising Star 2022/2023

View solution in original post

4 REPLIES 4

Community Alums
Not applicable

Hello Sandeep,

Thanks for sharing the link.

I already checked this however its based on users role and I want based on radio button selection.

Do you have any idea on that? 

 

Regards,

Kalyani Shaha

Community Alums
Not applicable

Hi @KalyaniShaha17 ,

 That link was for your reference as how to do it, now you will have to write a script such that on select of the radio button what you want to perform.

 

JagjeetSingh
Kilo Sage

Okay here is how you can do it. In UIB you get events which are triggered by components. Radio button component also triggers an event which you can use.

 

1. Create a state parameter to store the value selected in radio button. Lets call it selectedVal.

2. Go to the radio button events and add an event handler for event "Radio buttons value set". Follow steps shown below.

 

JagjeetSingh_0-1680358168462.png

 

3. Now, go to the container or component you want to show/hide based on this value.

4. Click on the hide component property and bind the value like below. Here you are hiding the component if the value equals to thisValue. Change it as per your need.

JagjeetSingh_1-1680358386769.png

 

 

Thats it!

 

 

Jagjeet Singh
ServiceNow Community Rising Star 2022/2023