phpwordpressgravity-forms-plugin

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

Solution

  • 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:

    http://gravitywiz.com/limiting-how-many-checkboxes-can-be-checked/

    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.

    http://gravitywiz.com/documentation/gp-limit-checkboxes/