A Toggle button control is used when the user has to choose between an ON and OFF state. When the state of the button is On, the value this control passes is TRUE and if the state is Off, the value is set to FALSE. For example, a user can select the features they want in their application by using a toggle button.
Properties of Text Control
- Label: Label is the text that is displayed above the toggle switch and helps the user to understand what they are supposed to input in the toggle switch.
- Properties: These properties help you customize the Label by changing the text size, weight ( Light, Normal, Bold, Extra Bold, X Extra Bold), alignment (Left, Center, Right, Justified) and color of the label.
- Type: The Type field is automatically generated depending upon the type of control used. In this case, it is a “Toggle_Button” type.
- Unique Name: A Unique Name is used to uniquely identify a control in your App. Every control that is added on the screen gets an auto-generated Unique Name on the basis of the Label name given to the control.
- Submit Data: This field lets you determine whether to send the value of the control or not in Workflow based on various control states. There are three conditions that could be set for this field.
- Always: When this condition is selected, the data in the toggle field will be submitted irrespective of the state of the toggle field.
- Never: When this condition is selected, the data in the toggle field will never be submitted irrespective of the state of the toggle field.
- No When Hidden: When this condition is selected, the data in the toggle field will be submitted if the toggle field is visible and not submitted when the toggle field is hidden.
- Required: When you select the required option, the field becomes a mandatory field and the user can not submit without filling it.
- Read Only: When you select this option, the user will no longer be able to edit this field.
- Hidden: The hidden option helps you to hide the field from the user. This might help to perform some computation you don’t want the user to see or if you want to show certain fields only when a specific condition is met/not met.
- Caching: When the caching option is selected and if a LOOKUP formula is applied to this control, the state that the LOOKUP returns will be cached and the user will be able to see this state even when he accesses the microapp later with no connectivity. This option is required when you want your app to be accessible in offline mode as well and getting the latest data from the sheets always is not critical.
- Hide Label: This option hides the label of the toggle field from the toggle switch.
- Theme: The theme lets you choose the color of the text box. You can either enter a custom hex code value or use one from the available themes in the builder.
How to Use a Toggle Button control?
Start with selecting the Toggle Button control from the Basic section of the Controls Menu.
The Toggle Button will then appear on the screen in the builder, you can then set all the above properties as per your requirements.
You can use the F option to bind data to the Toggle Button and the V option to add validations to the field. You can learn more about validations here. There are four ways in which you can bind data.
- Static Data: This can be used to directly type in the text that you want to bind.
- Sheet: This allows you to get data from a sheet and bind it to the Toggle Button.
- Control: This allows you to bind data to the Toggle Button by using another control’s value present in the microapp.
- Formula: This is used to apply formulas and bind the output of those formulas to the Toggle button. You can learn more about formulas here.