I want to show a popup when switching tabs. If I click 'No,' no action will be performed; if I click 'Yes,' the tab will switch.
Hi Ritik,
Please have a look at below link,
https://www.outsystems.com/forums/discussion/97576/how-to-prevent-switching-tab-in-tab-widget/
also attaching an OML for your reference.
Hope it helps.
Hi @Ritik Kulshrestha ,
1. First you will need to prevent the tab from switching, which can be done by using a CSS class:
.osui-tabs.no-tabbing-allowed .osui-tabs__header .osui-tabs__header-item{
pointer-events: none;
}
Add this class in the ExtendedClass property of your Tabs widget:
2. Instead of allowing direct tab switching, wrap your tab headers inside a container or link element and create an OnClick event. This event will handle the logic for displaying a confirmation popup.
3. Add an Input Parameter to your screen action to store the target tab index.
Create a Local Variable that will temporarily hold this value. This variable will be used later to switch tabs after confirmation.
4. In your screen action, assign the target tab index to the local variable and set the popup variable to display the popup.
5. In the action for "Yes" you can use the SetActiveTab action to switch the tab using the local variable that holds the tab index and an assign to hide the popup. And in the "No" action you can simply hide the popup.