AX1574

Toggle Switch component for Axiom forms

The Toggle Switch component is an interactive component that displays an on/off switch on the Axiom form. Users can click the switch to toggle it on or off, to enable or disable something in the form, or to otherwise toggle between two states.

Example toggle switches

NOTE: The Web Client Container must be enabled for the form in order to use this component. If the Web Client Container is not enabled, an error message will display on the component in the Form Designer, and when the form is rendered the component will display as a check box instead of a toggle switch.

Component properties

You can define the following properties for a Toggle Switch component.

Component properties can be configured using the Form Assistant task pane or the Form Designer unless otherwise noted. All properties can also be defined on the Form Control Sheet directly if desired. For example, if you want a property to be dynamic depending on the result of a formula, you can define that formula in the control sheet. To access the control sheet settings for the component, double-click any property name to go to that property in the Form Control Sheet.

Component behavior properties

The following properties control the display and behavior of this particular component type.

Item Description

Is Checked

The current state of the toggle switch, checked (On) or not checked (Off). This setting serves two purposes:

  • It specifies the initial state of the toggle switch, when the user first opens the form. By default, this is disabled, which means the toggle switch is set to Off. If you want the toggle switch to be set to On initially, then enable this setting.

  • When a user views the form and toggles the switch on or off, this state change will be submitted back to the source file and placed in this cell on the Form Control Sheet. Formulas can reference this cell in order to dynamically change the form based on the current state of the toggle switch.

NOTES:  

  • This setting supports indirect cell references. You can enter a cell reference in brackets, such as [Info!B3]. This causes the checked status to be read from and written to the specified cell reference instead of directly within the Is Checked cell.

  • This setting supports use of the FormState tag and the SharedVariables tag, so that the checked status is stored in memory instead of written to the file, and therefore can be shared with other files. Form state can be used to share values between a form dialog and an active client spreadsheet, in the Desktop Client. Shared variables can be used to share values between multiple forms that are open in a shared form instance (embedded forms).

On Text

Optional. Defines text to display when the switch is toggled to On. By default, the text On is used if no alternate text is defined.

Off Text

Optional. Defines text to display when the switch is toggled to Off. By default, the text Off is used if no alternate text is defined.

Tooltip

Optional. The tooltip text for the component. When a user hovers the cursor over the component, the text displays in a tooltip.

Auto Submit

Specifies whether the Axiom form is automatically updated when a user changes the state of the component.

By default, this is enabled, which means that the form automatically updates when the user toggles the switch on or off. If this setting is disabled, then the user must use a Button component in order to update the form for the changed state.

For example, you might disable the auto-submit behavior if the toggle switch is one of several user selections that are intended to be submitted together at one time, instead of piecemeal as each one changes. In that situation the user can make all necessary changes for all related components, and then click a Button component to submit the changes at once and trigger an update.

Save on Submit

Specifies whether a save-to-database occurs when a form update is triggered by this component.

  • If disabled (default), then changing this component does not trigger a save-to-database.

  • If enabled, then a save-to-database will occur as part of the form update process when this component triggers an update. The save occurs after editable values have been submitted to the source file and after data has been refreshed in the source file. A save-to-database process must be enabled and configured within the source file. For more information, see Saving data from an Axiom form.

This setting only applies if Auto Submit is enabled for the component. If you are not using the auto-submit behavior but you do want to save data to the database from the Axiom form, then you should instead enable Save on Submit for the Button component that you are using to trigger the update process.

Enabled

Specifies whether the component is enabled. By default this is set to On, which means that the component displays normally and users can interact with it (if applicable).

This setting can be used to dynamically enable or disable the component using a formula. If set to Off, then the component displays as grayed out. If the component is normally interactive, users cannot interact with the component while it is disabled. Disabled components cannot trigger update events for the form.

NOTE: This setting is only available on the Form Control Sheet; it cannot be set in the Form Assistant or in the Form Designer.

General properties

The following general properties are available for all components:

Item Description

Component Name

The name of the component. This is for identification in the file; this name does not display on the Axiom form canvas.

The name of the component identifies the corresponding settings for the component on the Form Control Sheet. The component names are also useful if you have multiple types of the same component within an Axiom form, so that you can tell which component you are currently editing.

Component names must be unique within a file and must start with a letter. Names can only contain letters, numbers, and underscores. Names are validated when the file is saved; an invalid name will prevent the save.

NOTE: Spaces are not allowed in component names and will be automatically removed by Axiom Software. For example, if you enter "My Component" as the component name, it will be automatically adjusted to "MyComponent".

Visible

Specifies whether the component is visible on the Axiom form (On/Off). By default this is set to On.

This setting can be used to dynamically show or hide the component using a formula. Keep in mind that if you have multiple components that you need to dynamically show or hide based on the same condition, then it is preferable to place those components on a dedicated layer and then show or hide the entire layer instead of the individual components.

NOTE: This setting is only available on the Form Control Sheet; it cannot be set in the Form Assistant or in the Form Designer.

Layer

The layer that the component belongs to on the Axiom form canvas. In the Form Assistant and the Form Designer, this displays as the layer name (for example: Layer 1). In the Form Control Sheet, this is recorded as the layer ID (for example: 1).

If the canvas only has one layer, then the component is automatically assigned to that layer and cannot be changed. If the canvas has multiple layers, you can assign the component to any layer using the drop-down list. By default, the component will be assigned to whichever layer is selected in the Layers box when you initially drag the component onto the canvas. For more information on layers, see Using multiple layers on the canvas.

If desired, you can jump to the applicable layer settings on the Form Control Sheet by clicking the binoculars icon next to the drop-down list.

Parent

The parent component that this component is assigned to. If blank, then the component does not have an assigned parent. Currently, only Panel components can be designated as parents.

If a component has an assigned parent, then that component is positioned within the parent instead of within the canvas at large. If the parent is hidden, all "child" components of that parent are also hidden.

The parent assignment is automatically completed when a component is dragged into a panel in the Form Designer, and automatically cleared when a component is dragged out of a panel. In most cases, you should not need to manually assign a parent.

For more information, see Using panels to group and position components.

Style and formatting properties

To define the component formatting, you can assign one or more styles to the component. Styles can impact formatting properties such as fonts, borders, and colors.

If you do not want to apply a style to this component, or if you want to override one or more formatting properties in an assigned style, click the Show Advanced Settings link underneath the Style box to display the individual formatting properties. For more information on defining individual formatting properties for a component, see Formatting overrides for Axiom form components.

Currently, the Axiom Software platform does not provide any styles specifically designed for Toggle Switch components. Only the generic styles are available.

Item Description

Style

Optional. The styles used to determine the formatting of the component. You can assign one or more styles.

Click the Select component styles button [...] to open the Choose Style dialog. Using this dialog, you can select one or more styles to apply to the component. The available styles depend on the component type and the skin assigned to the form. For more information, see Using component styles.

Some components have several styles that are specifically designed for that component type, while other components may only have the "generic" styles that are available to all components. When using a generic style, keep in mind that they may not be useful for all components. You can view a description of each style and view the effective formatting applied by the selected styles within the Choose Style dialog.

Component Theme

(Deprecated.) The theme to use for the component instead of the form-level theme. If left blank, the component uses the form-level theme.

This setting should be left blank unless you need to override the form theme. Generally speaking, themes should be set at the form level and only overridden at the component level when necessary.

This setting is available in the advanced component properties (click Show Advanced Settings under the Style box). On the Form Control Sheet, the setting displays using the name Theme Override.

NOTE: This setting only applies if your form uses a legacy skin (any skin except the default Axiom2018). The Axiom2018 skin does not use themes.

Position and size properties

You can view the position and size properties for a component by clicking the Show Advanced Settings link under the Style box. If necessary, you can edit these properties directly (instead of automatically modifying them by adjusting the component's position and size on the canvas). For more information on using these settings, see Controlling component position and size.

Item Description

Reference Location

The reference location determines how the x-position and y-position of a component are evaluated. By default the reference location is UpperLeft.

NOTE: This setting is not exposed in the advanced component settings. It can be changed on the canvas by double-clicking the corner selection handles of a component, or you can edit the setting on the Form Control Sheet directly.

X Position

Y Position

The x-position determines the component's position along the horizontal axis, and the y-position determines the component's position along the vertical axis. Both are evaluated relative to the reference location. Positions can be set in pixels (default) or percentages.

Width

Height

The width and height determine the size of the component. The width and height can be set in pixels (default) or percentages. Size keywords are also available to support special behavior.

Rendering Order

The order in which the component is rendered in the layer. A component with a larger order number will display above a component with a smaller order number.

For components that support tab navigation (tabbing to the next editable component), the rendering order also determines the tabbing order.

NOTE: On the Form Control Sheet, this setting is labeled as Z-Index.

Lock Layout

If enabled, the component size and position are locked and cannot be changed by dragging and dropping on the canvas. This optional setting is intended to protect against accidentally moving or resizing a component while working on the canvas.

Interactive behavior

The Toggle Switch component allows the user to toggle a switch between On or Off. The current state of the toggle switch is submitted back to the source file, and written to the Is Checked setting on the Form Control Sheet.

If you want the Axiom form to respond to the state of the toggle switch (on or off), then you must set up the file so that another component references the toggle switch state and changes based on it. For more information on setting up interactive components for an Axiom form, see Using interactive components in an Axiom form.

Example

An Axiom form could contain a column chart with three possible series. By default the chart shows two series, but if the toggle switch is set to On, the third series is shown. The series tag for the third series could be set up using an IF function so that the series only displays if the toggle switch is selected. For example:

=IF(Control_Form!D298="Off","No Show","[Series]")

In this example, the Is Checked setting for the toggle switch is located on the Form Control Sheet in cell D298. Therefore if the toggle switch state is Off, then this cell will contain the text "No Show," which means the series of data in this row will not display in the chart. But if the toggle switch state is On, then the series tag will display and therefore the associated data will display in the chart.

Design alternatives

Axiom forms often support several different ways of performing the same task, to provide a broad range of display options and user interface behavior. Depending on your form design, you may want to consider the following alternatives:

  • The CheckBox content tag can be used in Formatted Grid components to present a toggle switch within a grid. You may want to do this if your form is primarily grid-based, or if the toggle switches need to be integrated with the other contents of the grid (such as displaying a toggle switch on each row of a grid). There is not a separate tag for toggle switches; instead there is a parameter on the CheckBox tag that determines whether it displays as a check box or a toggle switch. For more information, see Using check boxes in Formatted Grids.