You can use the Toggle Button UI Pattern to provide users with a stand-alone control that allows them to choose between two states, for example, a Yes/No value.
How to use the Toggle Button UI Pattern
In this example, we create a toggle button to activate a widget that can is activated only when a condition is met.
In Service Studio, in the Toolbox, search for
The Toggle Button widget is displayed.
From the Toolbox, drag the Toggle Button widget into the Main Content area of your application's screen.
Right-click your screen name and select Add Local Variable.
Enter a name and select a data type. In this example, we enter the name
IsToggled, set the data type to Boolean and the default value to False.
In this example, we add some text and a button. We enter a name for the button (SubmitButton), and set the Enabled property to the local variable we created earlier (IsToggled).
Select the Checkbox widget, and on the Properties tab, from the Variable drop-down, select the local variable you just created (in this example, IsToggled).
From the OnChange Destination drop-down, select New Screen Action.
From the Toolbox, add the Ajax Refresh to the screen action, and in the Select Widget pop-up, navigate to and select the Submit button name (in this example, SubmitButton), and click OK.
After following these steps and publishing the module, you can test the pattern in your app.
|ExtendedClass (Text): Optional||Add custom style classes to the Toggle Button UI Pattern. You define your custom style classes in your application using CSS.