Skip to content

Instantly share code, notes, and snippets.

chrisegg / auto-advance-radio-select-fields.js
Created Nov 20, 2021
This snippet will support auto advancing pages in multi-page form for radio button and drop down field types. Full tutorial here:
View auto-advance-radio-select-fields.js
jQuery(document).ready(function($) {
$('input[type=radio], select').on('change', function() {
View gf-product-default-quantity.php
// Copy everything below this line
add_filter( 'gform_field_value_default_quantity', 'gr_default_qty' );
function gr_default_qty() {
return 0; // change this number to your desired default quantity
View gf-inline-button
// You will need to replace 123 in gform_submit_button_123 and gform_wrapper_123 with your forms ID number
// Copy everything below this line.
<button onclick="document.getElementById('gform_submit_button_123').click();" style="height: 2.5rem;padding:0 1rem;font-size:1rem;">
<style type="text/css">
chrisegg / gf-limit-payments.php
Last active Sep 6, 2021
Limit Stripe Subscriptions to a Specified Number of Payments
View gf-limit-payments.php
//Code provided by Gravity Forms here:
//Start copying below this line...
add_action( 'gform_post_add_subscription_payment', function ( $entry ) {
gf_stripe()->log_debug( "Running..." );
if ( rgar( $entry, 'payment_status' ) == 'Active' ) {
$feed = gf_stripe()->get_payment_feed( $entry );
chrisegg / hide-gravityforms-admin-header.php
Created Sep 6, 2021
Hide the Gravity Forms brand header in the WP Admin that was added in v2.5.
View hide-gravityforms-admin-header.php
//Copy everything below this point
add_action( 'admin_head', function () { ?>
header.gform-settings-header .gform-settings__wrapper {
/* this will hide the whole thing, including image */
display: none;
chrisegg / gravity_forms_readonly.js
Last active Aug 18, 2021
This code snippet works for text input fields only and can be placed in an HTML field within your form.
View gravity_forms_readonly.js
<script type="text/javascript">
/* apply only to a input with a class of gf_readonly */
jQuery(".gf_readonly input").attr("readonly","readonly");
View hide_submit_button.css
// Replace ID with your forms ID number.
body #gform_wrapper_ID .gform_footer input[type=submit] {
visibility: hidden;
View notifications_attach_file.php
// Do NOT include the opening php tag
// Replace 1 with your forms ID
// Replace User Notification with the name of your notification
// Insert your file path
add_filter( 'gform_notification_1', 'add_notification_attachments', 10, 3 );
function add_notification_attachments( $notification, $form, $entry ) {
if ( $notification['name'] == 'User Notification' ) {
$path = 'path/to/file.pdf';
chrisegg / gforms_remove_button
Last active Jan 26, 2021
Replace the ID with your form ID number. Place this code in you functions.php file or a custom functions plugin
View gforms_remove_button
// Replace ID with your forms ID number.
add_filter( 'gform_submit_button_ID', '__return_false' );
chrisegg / radio-button-submit
Last active Dec 25, 2020
This snippet will allow you to use a radio button field to submit the form without using the submit button.
View radio-button-submit
 jQuery(document).ready(function($) {
 $('input[type=radio]').on('change', function() {