How to require all checkboxes ticked

The following code shows how to make a checkbox field in Gravity Forms require all options be ticked if the field is required.

By default, if the field is required only one needs to be ticked.

If you’re not sure where to place this code I highly recommend you read How to create a WordPress plugin for your custom functions.

Note: change form id and field id to match your form.

add_filter( 'gform_field_validation', 'checkbox_all_required', 10, 4 );
function checkbox_all_required( $result, $value, $form, $field ) {
	if ( 1 = $form['id'] && 1 = $field->id && 'checkbox' == $field->get_input_type() && $field->isRequired ) {
		foreach ( $value as $choice ) {
			if ( empty( $choice ) ) {
				$result['is_valid'] = false;
				$result['message'] = 'All checkboxes must be ticked.';
				break;
			}
		}
	}
    return $result;
}

This uses the gform_field_validation filter that allows you to filter by form or form and field. See the Gravity Forms documentation for examples of how to use this filter.