Skip to content

Instantly share code, notes, and snippets.

@spivurno
spivurno / gw-gravity-forms-checkbox-count.php
Last active April 20, 2024 21:21
Gravity Wiz // Gravity Forms // Checkbox Count
<?php
/**
* --------------------------------------------------------------------------
* IMPORTANT!
* This snippet has been superceded by the Choice Counter snippet.
* https://gist.github.com/spivurno/00af5ee7e21dd5d6903fbae6fecd85ce
* --------------------------------------------------------------------------
*
* Gravity Wiz // Gravity Forms // Checkbox Count
*
@spivurno
spivurno / gw-gravity-forms-advanced-conditional-logic.php
Last active March 5, 2024 11:32
Gravity Wiz // Gravity Forms // Advanced Conditional Logic
<?php
/**
* Gravity Wiz // Gravity Forms // Advanced Conditional Logic
*
* PLEASE NOTE: This snippet is a proof-of-concept. It is not supported and we have no plans to improve it.
*
* Allows multiple groups of conditional logic per field.
*
* @version 0.1
* @author David Smith <david@gravitywiz.com>
@spivurno
spivurno / gw-gravity-forms-change-field-id.js
Last active December 12, 2023 01:56
Gravity Wiz // Gravity Forms // Change Field ID via Browser Console
/**
* WARNING! THIS SNIPPET MAY BE OUTDATED.
* The latest version of this snippet can be found in the Gravity Wiz Snippet Library:
* https://github.com/gravitywiz/snippet-library/blob/master/gravity-forms/gw-change-field-id.js
*/
/**
* Gravity Wiz // Gravity Forms // Change Field ID via Browser Console
*
* Provides a simple function for changing the ID of a Gravity Forms field via the browser console from the Form Editor page.
*
@spivurno
spivurno / gw-gravity-forms-populate-form.php
Last active November 24, 2023 05:14
Gravity Wiz // Gravity Forms // Populate Form with Entry (Optionally Update Entry on Submission)
<?php
/**
* Gravity Wiz // Gravity Forms // Populate Form with Entry (Optionally Update Entry on Submission)
*
* Pass an entry ID and populate the form automatically. No form configuration required. Optionally update the entry on
* submission.
*
* @version 1.5
* @author David Smith <david@gravitywiz.com>
* @license GPL-2.0+
@spivurno
spivurno / gist:3708752
Created September 12, 2012 18:12
Gravity Wiz // Limit How Many Checkboxes Can Be Checked
<?php
/**
* Limit How Many Checkboxes Can Be Checked
* http://gravitywiz.com/2012/06/11/limiting-how-many-checkboxes-can-be-checked/
*/
class GFLimitCheckboxes {
public static $field_limits;
@spivurno
spivurno / gw-gravity-forms-submission-limit.php
Last active October 23, 2023 15:33 — forked from spivurno/gist:3710653
Gravity Wiz // Gravity Forms // Limit Submissions Per Time Period (by IP, User, Role, Form URL, or Field Value)
<?php
/**
* WARNING! THIS SNIPPET MAY BE OUTDATED.
* The latest version of this snippet can be found in the Gravity Wiz Snippet Library:
* https://github.com/gravitywiz/snippet-library/blob/master/gravity-forms/gw-submission-limit.php
*/
/**
* Gravity Wiz // Gravity Forms // Limit Submissions Per Time Period (by IP, User, Role, Form URL, or Field Value)
*
* Limit the number of times a form can be submitted per a specific time period. You modify this limit to apply to
@spivurno
spivurno / gw-limit-checkboxes-usage.php
Last active October 23, 2023 15:33 — forked from spivurno/gist:4005779
Gravity Wiz // Limit Checkboxes Usage
<?php
// standard usage
new GFLimitCheckboxes(115, array(
5 => array(
'min' => 2,
'max' => 3
)
));
@spivurno
spivurno / gw-gravity-forms-disable-autocomplete.php
Last active October 23, 2023 15:33 — forked from ronalfy/gravity-forms-disable-autocomplete.php
Gravity Wiz // Gravity Forms // Disable Auto-complete
<?php
// Disable auto-complete on form.
add_filter( 'gform_form_tag', function( $form_tag ) {
return str_replace( '>', ' autocomplete="off">', $form_tag );
}, 11 );
// Diable auto-complete on each field.
add_filter( 'gform_field_content', function( $input ) {
return preg_replace( '/<(input|textarea)/', '<${1} autocomplete="off" ', $input );
@spivurno
spivurno / gw-gravity-forms-first-error-focus.php
Last active October 23, 2023 15:33 — forked from hirejordansmith/add-cursor-focus-first-gf-field-validation-error-all-forms.php
Gravity Wiz // Gravity Forms // Give First Validation Error Focus
<?php
/**
* Gravity Wiz // Gravity Forms // Give First Validation Error Focus
* http://gravitywiz.com/
*
* Plugin Name: Gravity Forms First Error Focus
* Plugin URI: https://gravitywiz.com/make-gravity-forms-validation-errors-mobile-friendlyer/
* Description: Automatically focus (and scroll) to the first field with a validation error.
* Author: Gravity Wiz
* Version: 1.1
@spivurno
spivurno / gw-gravity-forms-set-input-as-tel.php
Last active October 23, 2023 15:33 — forked from hirejordansmith/convert-text-field-tel-field.php
Gravity Wiz // Gravity Forms // Set Input Type as Tel
<?php
/**
* Gravity Wiz // Gravity Forms // Set Input Type as Tel
* http://gravitywiz.com/
*/
add_filter( 'gform_field_content_723_10', 'gw_set_tel_input_type' );
function gw_set_tel_input_type( $input ) {
$input = preg_replace( "/type='[\\w]+'/", "type='tel'", $input );
return $input;
}