Limiting How Many Checkboxes Can Be Checked on Gravity Forms

I need to limit how many checkboxes can be checked on my gravity forms. But it makes an error. This is my code :

new GFLimitCheckboxes(2, array(37 => array('max' => 2)));

My error :

Fatal error: Class 'GFLimitCheckboxes' not found in /Prohai/wp-content/themes/prohai/functions.php on line 272
2

1 Answer

msbodetti is correct. You need to include the GFLimitCheckboxes class either in your theme's functions.php file or via a snippet manager plugin (like this one). Refer to the full article for details:

If you don't want to be bothered with the code, this functionality is available as a plugin with Gravity Perks and can be administered from the field settings for your checkbox fields. The "perk" you're interested in is called "GP Limit Checkboxes". Here is a link to the documentation for the plugin-version which includes some examples of what it looks like in action.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Elena Rostova

Elena Rostova

Lead Health, Wellness & Medical Journalist

Elena Rostova holds a Master's degree in Public Health Journalism. She covers groundbreaking medical research, holistic wellness trends, mental health awareness, and nutritional science.

Share this article
Twitter Facebook Pinterest