How to Add a āNone of the Aboveā option to your Checkbox Field
Learn how to create a āNone of the Aboveā checkbox. When āNone of the Aboveā is selected, all other options are disabled. When any other option is selected, āNone of the Aboveā is disabled.

Imagine youāre a marketer at your company, and youāre looking to get feedback on which types of social media your users prefer. You could create a form and show each type as a checklist. It would also be nice to give users a āNone of the Aboveā option, just in case they donāt like any of the options. But, what happens if a user chooses several options and āNone of the Aboveā at the same time? It can get confusing, very quickly:

Thankfully, thereās a smarter way to handle this scenario with this snippet. By following the steps below, youāll be able to add a āNone of the Aboveā option to your checkbox field that works like this:
- When āNone of the Aboveā is selected, all other choices are disabled.
- When any other choice is selected, the āNone of the Aboveā option is disabled.

Steps
Step 1 ā Install the āNone of the Aboveā Snippet
Weāll start by installing this custom snippet. Since itās a JavaScript snippet, we recommend using the free Gravity Forms Code Chest plugin. This is a plugin we made that makes it easy to add JavaScript snippets to your forms.
Once the plugin is installed, navigate to your Form Settings. Copy all of the text from the snippet file into the Custom Javascript text box:

Step 2 ā Add the Form Fields
Next, build your form and add your fields as normal. Add a Checkbox field with all of the choices you want your users to pick from. Be sure to add āNone of the Aboveā as the last choice:

Step 3 ā Add Custom CSS
Finally, weāll add a CSS class to the Checkbox field so the snippet knows which field to target. Click on the Checkbox field and add this text to the Custom CSS Class field under the Appearance header: gw-none-of-the-above
.

You can add this CSS class to as many Checkbox fields as youād like.
Taking it Further
To check if the choices we display are relevant to users, we can count how many times āNone of the Aboveā was selected. A high count may indicate that we should reconsider which options weāre displaying.
First, weāll start by adding a Number field called āNone of the Above countā to our form. Weāll set this field to be hidden from users. Take note of the field ID in the top right corner ā weāll need this later:

Once the number field is created, weāll install this custom snippet. Since this snippet is a PHP snippet, the install process is slightly different than the āNone of the Aboveā snippet. Take a look at our instructions here that explain how to install a PHP snippet.
Add the following to the bottom of the snippet code:
new GW_Choice_Count( array(
'form_id' => 123, // The ID of your form.
'count_field_id' => 2, // Any Number field on your form in which the number of checked checkboxes should be dynamically populated; you can configure conditional logic based on the value of this field.
'choice_field_ids' => 1, // Any array of Checkbox or Multi-select field IDs which should be counted.
'values' => array( 'None of the Above' ), // Specify an array of values that should be counted. Values not in this list will not be counted. Defaults to `false` which will count all values.
) );
- Replace
form_id
with your formās ID. - Replace
count_field_id
with your Number fieldās ID. - Replace
choice_field_ids
with your Checkbox field ID. You can use multiple field IDs in an array. - Replace
values
if youāre looking to include choices other than āNone of the Aboveā.
Check out the full article here for more information.
Hi, I tried doing this but got the following error when adding the php snippet:
Uncaught Error: Class āGW_Choice_Countā not found in wp-content/themes/bb-theme-child/functions.php:2086 Stack trace:
0 wp-settings.php(591): include()
1 wp-config.php(118): require_once(ā/home/charliesdā¦ā)
2 wp-load.php(50): require_once(ā/home/charliesdā¦ā)
3 wp-admin/admin.php(34): require_once(ā/home/charliesdā¦ā)
4 wp-admin/theme-editor.php(10): require_once(ā/home/charliesdā¦ā)
5 {main}
thrown
Any ideas?
Hi Mike,
Based on the error message, it looks like you do not have the Choice count snippet on your website. What you copied is just the configuration. Hereās the link to the documentation for the choice counter and a link to the snippet.
Best,