- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-30-2023 09:43 PM
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
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-01-2023 07:13 AM
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.
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.
Thats it!
ServiceNow Community Rising Star 2022/2023
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-30-2023 09:52 PM
Hi @KalyaniShaha17 ,
You can refer to this article :https://www.servicenow.com/community/next-experience-articles/how-to-hide-a-container-component-in-u...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-30-2023 10:07 PM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-30-2023 10:21 PM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-01-2023 07:13 AM
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.
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.
Thats it!
ServiceNow Community Rising Star 2022/2023