Skip to content

Instantly share code, notes, and snippets.

//Copy everything below this line
/**
*
* Conditionally Disable Radio Button Field
*
* This snippet disables a radio button field when a specific choice is selected in another radio button field.
* It will even clear the choice selection of the disabled field.
* See the link below for instructions.
*
@chrisegg
chrisegg / gr-limit-checkbox-selection.js
Created October 17, 2023 01:04
This snippet allows you to limit the number of checkboxes that can be checked, and grays out and disables all other choices when that number is reached.
/**
* GravityRanger Limit Checkboxes
*
* This snippet allows you to limit the number of checkboxes that can be checked, and grays out and disables all other choices when that number is reached.
*
*
* @instructions:
*
* 1. Change 2 on line 24 to the number of checkbox choices you want the user to be able to select.
* 2. Change the 1_5 on line 27 to the formID_fieldID of your checkbox field.
@chrisegg
chrisegg / entry-details-view-log-button-metabox.php
Created October 16, 2023 23:38
This snippet adds a button to the entry details page that allows you to easily view the Gravity Forms core log file when enabled.
<?php
//Copy everything below this line
/**
*
* Entry Details Log Button
*
* This snippet adds a button to the entry details page that allows you to easily view the Gravity Forms core log file when enabled.
*
* @Version: 1.0
@chrisegg
chrisegg / change-admin-email.php
Created August 19, 2023 21:46
Use this to change the {admin_email} for all Gravity Forms Admin Notifications
<?php
//copy everything below this line
add_filter( 'gform_notification', 'change_notification_email', 10, 3 );
function change_notification_email( $notification, $form, $entry ) {
if ( $notification['name'] == 'Admin Notification' ) {
// toType can be routing or email
@chrisegg
chrisegg / GravityForms Default Countries
Created June 28, 2022 13:18
List of currently available countries in the Address field country dropdown.
'AF' => __( 'Afghanistan', 'gravityforms' ),
'AX' => __( 'Åland Islands', 'gravityforms' ),
'AL' => __( 'Albania', 'gravityforms' ),
'DZ' => __( 'Algeria', 'gravityforms' ),
'AS' => __( 'American Samoa', 'gravityforms' ),
'AD' => __( 'Andorra', 'gravityforms' ),
'AO' => __( 'Angola', 'gravityforms' ),
'AI' => __( 'Anguilla', 'gravityforms' ),
'AQ' => __( 'Antarctica', 'gravityforms' ),
'AG' => __( 'Antigua and Barbuda', 'gravityforms' ),
<?php
/**
*
* GravityRanger // Gravity Forms Reset Button
* https://gravityranger.com/gravity-forms-reset-button/
*
* Use this code snippet to add a reset button to your forms.
* Code snippet will add the button to all forms by default.
*
@chrisegg
chrisegg / form-auto-submit.js
Created February 12, 2022 23:58
Allows you to auto-submit a form when the page loads, with a 1/2 second delay. Full tutorial here: https://gravityranger.com/auto-submit-form-page-load/
/**
* GravityRanger Auto-Submit Form on Page Load
*
* Allows you to auto-submit a form when the page loads, with a 1/2 second delay.
* https://gravityranger.com/auto-submit-form-page-load/
*
* @instructions:
*
* 1. Change gform_ID# to your forms ID number (line 24)
* 2. Set the amount of time you'd like to delay the script (line 27)
<?php
//Copy everything below this line
/**
* GravityRanger Change Submit Button Text
*
* Allows you to change the submit button text after the button is clicked.
* https://gravityranger.com/change-gravity-forms-submit-button-text-after-submission/
*
* @instructions:
@chrisegg
chrisegg / gf-text-redirect-confirmaton.js
Last active December 20, 2021 20:18
Use this code snippet if you'd like to display a text confirmation before redirecting the user to another page/url with Gravity Forms.
/**
* GravityRanger
* https://gravityranger.com/display-text-confirmation-before-redirecting-gravity-forms/
*
* Used to display a text message after a form is submitted, but triggers a redirect 2 seconds after message is displayed.
*
* Instructions: Copy and paste lines 11-17 into a Gravity Forms text confirmaton. Make any necessary changes to the text or number of seconds, i.e 2000 = 2 seconds, (line 16).
*
*/
@chrisegg
chrisegg / gf-dual-confirmation.php
Last active March 26, 2023 20:37
Uses the gform_confirmation hook to display a text confirmation message before triggering the redirect confirmation.
<?php
// Copy everything below this line
/**
* GravityRanger Dual Confirmation (text + redirect)
* https://gravityranger.com/display-text-confirmation-before-redirecting-gravity-forms
*
* Uses the gform_confirmation hook to display a text confirmation message before triggering the redirect confirmation.
* This code is a modified version of the snippet provided on docs.gravityfroms.com
*