🎉 Celebrate with 10% OFF on All Products! Use Code: GFEX10 Or Buy Any 2+ Items for 30% OFF with Code: GFEX30!

Gravity Forms Toggle Switch Premium Add-on Setup Guide

Updated 10 min read Gravity Forms Integrations A–Z
On this page
  1. Video walkthrough
  2. What You Get
  3. Requirements
  4. Installation
  5. The Field Settings
  6. Required Means On
  7. What Is Saved
  8. Group of Switches
  9. Conditional Logic
  10. A switch as the source
  11. A switch as the target
  12. Merge Tags
  13. Calculations
  14. Prices
  15. Accessibility and Keyboard
  16. Works Everywhere in Gravity Forms
  17. Styling
  18. Troubleshooting
  19. Frequently Asked Questions
  20. Does it make requests to an outside service?
  21. What is saved when the switch is off?
  22. Can I use text such as Subscribed and Not subscribed?
  23. Can the switch be on by default?
  24. What happens when my license expires?
  25. Switch it on, save what you say

Video walkthrough

Gravity Forms Toggle Switch Field: On/Off Switches with Prices, Groups and Conditional Logic
Watch: add on/off switches with prices, groups and conditional logic in Gravity Forms, step by step. Watch on YouTube

Toggle Switch adds one new field to Gravity Forms: Toggle Switch. It is the on/off switch people know from their phone, with your own on and off values and labels beside the switch that change with the state. Put it where a checkbox feels clumsy: accept the terms, subscribe to news, gift wrap this order, remember me. Switch the field to a group and you get several switches in one field, each with its own label and value.

An Account preferences form with three single switches, a group of three notification switches and a required terms switch, each with a label beside it that shows the current state
Single switches with their own labels, a group of switches and a required switch, in the Orbital theme.

What You Get

  • A single switch that saves the on value or the off value you choose, such as Yes and No or 1 and 0.
  • Labels beside the switch for the on state and the off state, a default state, three sizes and a theme or custom colour.
  • Required means the switch must be on, which is what terms and consent fields need.
  • A group of switches in one field, each with its own label, value and optional price.
  • Conditional logic that uses a switch as a source (is on, is off) or as a target.
  • Merge tags that show the saved value, or the label with the text modifier.
  • Numeric on and off values that work in number field formulas.
  • An amount added to the order when a switch is on: as its own line, as part of a product price, or one by one in a group.
  • A real checkbox with role switch, aria-checked, Space and Enter support, a visible focus ring and a fallback that works without JavaScript.
  • AJAX forms, multi-page forms, Save and Continue, the Orbital theme, legacy markup and the admin entry editor.
  • No outside requests.

Requirements

  • Gravity Forms 2.9 or newer (tested with 2.9 and 3.1), WordPress 6.5 or newer and PHP 7.4 or newer.
  • An active license key. Without one the field turns into a plain checkbox that still saves its values, so a lapsed license never breaks a form.

Installation

  1. Install and activate the add-on in the usual way.
  2. Open Forms → Settings → Toggle Switch, enter your license key and activate it.
  3. Open a form in the editor and add Toggle Switch from the Advanced Fields group.

The Field Settings

Select the field and open the General tab. The settings of the switch sit between the field label and the description.

The settings of the Toggle Switch field in the form editor: mode, on and off values, labels beside the switch, default state, size, colour and the price when on
Everything is set on the field itself in the form editor.
Setting What it does
Mode Single switch is one on/off switch. Group of switches is several switches in one field, like checkboxes.
On value and Off value The text saved in the entry for each state. The two values must differ; if you type the same text twice the add-on makes the off value different for you.
Labels beside the switch The text shown next to the switch while it is on and while it is off. Leave one empty to show nothing in that state. The field label above the switch stays as it is.
Default state On or Off when the form first loads. A default of On is also what Save and Continue brings back on a page that was not reached yet.
Size Small (36 by 20 pixels), Medium (48 by 26) or Large (62 by 34).
Colour when on Form theme accent follows the accent colour of the form, so the switch matches your theme. Custom lets you pick one colour.
Price when on An amount added to the order while the switch is on. See Prices below.

Required Means On

A required checkbox normally means it must be checked. A required switch means the same: it must be on. Use it for terms of service, consent to be contacted or a privacy notice. If the visitor sends the form with the switch off, the form is refused and shows the field error. The default message is Please switch this on to continue. and you can change it under the field settings. The switch keeps its state while the page shows the error.

A switch that is not required has no such rule: both states are valid answers and the entry stores the on value or the off value.

What Is Saved

A plain checkbox that is off sends nothing, so an entry can only tell that it was left empty. The Toggle Switch saves the off value instead. With on value Yes and off value No, an entry always has either Yes or No for the switch, which makes reports, exports and notifications much easier to read.

Where What you see
Entry list and entry detail The saved value, for example Yes or No, or 1 or 0.
Notifications and confirmations The saved value. Add the text modifier to show the label of the state instead.
Exports The saved value in one column.
The admin entry editor The switch in its saved state. Change it and update the entry like any other field.

A field that conditional logic hides saves nothing, as for every other field.

Group of Switches

Change the mode to Group of switches to put several switches in one field. The settings panel then lists the switches. For each one you set a label, a value, an optional price and whether it starts on. Add switches with the button and remove them with the cross. The value starts as a copy of the label, so you can leave it alone when you do not need a different one.

Underneath, a group is a Gravity Forms checkbox field. That means entries, exports, notifications, merge tags and conditional logic behave exactly as they do for checkboxes: every switch has its own input in the entry, and a merge tag lists the switches that are on. A required group needs at least one switch on.

Conditional Logic

A switch as the source

Use a single switch in the rules of other fields. Choose the switch, the operator is or is not, and one of its two values; the list offers both the on value and the off value. A rule on the off value works too, so you can show a field only while a switch is off, for example Tell us why not while the newsletter switch is off. A group works like checkboxes: pick the switch you want and use is.

A switch as the target

Conditional logic on the switch field itself works as on any field: show or hide it depending on other fields, including other switches. A hidden switch is not saved and does not count in calculations or totals.

Merge Tags

Use the merge tag of a switch in notifications and confirmations. By default it shows the saved value. Add the text modifier to show the label that belongs to the state.

<p>Newsletter: {Newsletter:2}</p>
<p>Shown to the customer as: {Newsletter:2:text}</p>
{all_fields}
Merge tag Result with on value 1, off value 0 and labels Subscribed and Not subscribed
Newsletter:2 1 or 0
Newsletter:2:text Subscribed or Not subscribed

Replace Newsletter and 2 with the label and the id of your field. The all_fields merge tag shows the saved value, and groups show the labels of the switches that are on, as checkboxes do.

Calculations

Give a switch numeric values and use it in the formula of a number field with calculation turned on. A rush delivery switch with on value 25 and off value 0 adds 25 when it is on. A double switch with on value 2 and off value 1 doubles a quantity. The result is recalculated live while the visitor flips the switches, and calculated again on the server when the form is sent.

({Base price:1} + {Rush:2}) * {Double:3}

A switch that conditional logic hides counts as zero, as other hidden fields do. Text values such as Yes and No are not numbers, so for calculations choose numeric values.

Prices

Enter an amount in Price when on and it is added to the order while the switch is on. Prices need a Gravity Forms product field in the form, because the total is calculated from the products, and a Total field to show it. The amount appears beside the label of the switch so the visitor sees what it costs.

A Mug order form with a product, a quantity, a Gift wrap switch that adds 5 dollars, an Engraving switch that adds 3.50 dollars to the product, three priced group switches and a total of 115.25 dollars
Switches can add to the order: as their own line, as part of a product price, or one by one in a group. The total follows live.
Counted as What happens
Its own order line The amount is a separate line in the order, with the label of the switch as its name. It is added once, whatever the quantity of the products.
Part of a product The amount is added to the price of the product you choose, the way a product option is, and so it is multiplied by the quantity of that product. If that product is not in the order, nothing is added.
A switch in a group Each switch of a group has its own price field and is added as its own order line when it is on.

The total field updates live. The entry, the order summary, notifications that show the order and payment add-ons use the same order lines, so what the visitor saw is what is charged.

Accessibility and Keyboard

The switch is a real checkbox with role="switch", so assistive technology announces it as a switch and reads its state. A small script keeps aria-checked in step with the state. People who use the keyboard get what they expect:

  • Tab moves to the switch and shows a clear focus ring around it.
  • Space toggles the switch, as on any checkbox.
  • Enter toggles it too, and does not send the form while the focus is on a switch.
  • The label beside the switch is clickable, and so is the switch itself.
  • The state labels are real text: the one that does not apply is hidden from everybody, including screen readers.
  • With forced colors or reduced motion the switch adapts: it uses system colors and does not animate.

Without JavaScript the field is still a checkbox, and the switch look comes from CSS alone. Clicking it checks the box, the label changes and the form saves the right value. Only aria-checked needs the script, and without it the native checkbox state is read as it always is.

Works Everywhere in Gravity Forms

  • AJAX forms: the switches start again after a validation error and keep their state.
  • Multi-page forms: the state travels between pages, back and forward, with or without AJAX.
  • Save and Continue: the resume link brings back every switch, and a default of On on a page you had not reached is still On.
  • Orbital theme and legacy markup: the switch looks the same in both.
  • Phones: the large size is easy to hit with a thumb.

Styling

The switch follows the accent colour of your form theme. To restyle it, set the custom properties on the element with the class gets. They control size, colours and the focus ring.

Property Controls
–gets-w and –gets-h Width and height of the track. The thumb is sized from them.
–gets-pad Space between the thumb and the track.
–gets-on Track colour while on.
–gets-off Track colour while off.
–gets-thumb Colour of the thumb.
–gets-focus Colour of the focus ring.
.gets.gets--single {
    --gets-on: #0f766e;
    --gets-off: #94a3b8;
}

For a single field, choose a custom colour in the field settings instead of writing any CSS.

Troubleshooting

Problem Check
The field looks like a plain checkbox The license key must be active. Without it the field is a plain checkbox that still saves its values. Activate it under Forms, Settings, Toggle Switch.
The entry shows nothing for the switch A field that conditional logic hides saves nothing. Otherwise an entry has the on value or the off value. If the form was sent before you added the field, the entry has no value for it.
A rule on the off value does not match Use the exact off value of the field in the rule. After you change a value, open the rule and choose the value again.
The calculation ignores the switch The values must be numbers such as 25 and 0. Text values such as Yes and No count as zero.
The price does not show in the total The form needs a product field and a Total field, and the switch must be on and not hidden by conditional logic.
A required switch refuses the form That is the rule: required means the switch must be on. Remove the required setting if both answers are valid.

Frequently Asked Questions

Does it make requests to an outside service?

No. The switch is drawn with CSS and the script runs in the visitor browser without contacting anything.

What is saved when the switch is off?

The off value you set, for example No or 0. An unchecked checkbox sends nothing, so the add-on saves the off value once the form is sent.

Can I use text such as Subscribed and Not subscribed?

Yes. The values are any text you like. Use the labels for what the visitor reads and the values for what you store.

Can the switch be on by default?

Yes. Set the default state to On. It is on when the form loads and when a saved form is resumed on a page that was not reached.

What happens when my license expires?

The field becomes a plain checkbox. Your forms and entries stay as they are and the form keeps working.

Switch it on, save what you say

On/off switches with your own values, labels, pricing and conditional logic for Gravity Forms.

Still need help?

Our support team answers tickets every day, usually within a few hours.

0
0
Your Cart
Your cart is emptyReturn to Shop
🔥 FREQUENTLY BOUGHT TOGETHER
Complete Combo & Save 40%!
ITEM IN YOUR CART
Gravity Forms Klaviyo Add-on
$39.00/yr
+
🎁 RECOMMENDED ADD-ON SAVE 40% OFF
Original Price: $39.00/yr
Bundle Special Price: $23.40/yr