Gravity form hide past date & restrict min and max date

<script>
gform.addFilter('gform_datepicker_options_pre_init', function(optionsObj, formId, fieldId) {
    // Apply to field 23 in form 7 or form 9
    if ((fieldId == 23) && (formId == 9)) {
        // Disable past dates
        optionsObj.minDate = 0;

        // Restrict to Tuesday (2), Wednesday (3), and Thursday (4)
        optionsObj.beforeShowDay = function(date) {
            var day = date.getDay(); // 0 = Sunday, 1 = Monday, ..., 6 = Saturday
            return [day === 1 || day === 2 || day === 3 || day === 4 || day === 5]; // Allow only Tue, Wed, Thu
        };
    }
	
	 if ((fieldId == 9 || fieldId == 14 || fieldId == 19) && (formId == 9)) {
        optionsObj.maxDate = 0;
    }
    return optionsObj;
});
</script>

Gravity form Hide Past Date and Restrict days

<script>
gform.addFilter('gform_datepicker_options_pre_init', function(optionsObj, formId, fieldId) {
    // Apply to field 23 in form 7 or form 9
    if ((fieldId == 23) && (formId == 7 || formId == 9)) {
        // Disable past dates
        optionsObj.minDate = 0;

        // Restrict to Tuesday (2), Wednesday (3), and Thursday (4)
        optionsObj.beforeShowDay = function(date) {
            var day = date.getDay(); // 0 = Sunday, 1 = Monday, ..., 6 = Saturday
            return [day === 2 || day === 3 || day === 4]; // Allow only Tue, Wed, Thu
        };
    }
    return optionsObj;
});
</script>

Gravity form set cookies after confirmaiton

// Gravity form set cookies after confirmaiton
add_action( 'gform_confirmation', 'set_cookie_after_confirmation', 10, 4 );
function set_cookie_after_confirmation( $confirmation, $form, $entry, $ajax ) {
    ?>
    <script type="text/javascript">
        // Function to set the cookie
        function setCookie(name, value, days) {
            var expires = "";
            if (days) {
                var date = new Date();
                date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
                expires = "; expires=" + date.toUTCString();
            }
            document.cookie = name + "=" + (value || "") + expires + "; path=/";
        }

        // Set your cookie here
        setCookie('parent_corner_show_content', 'true', 30); // Change 'your_cookie_name' and 'your_cookie_value' accordingly
    </script>
    <?php
    return $confirmation;
}

Gravity form sate name abbreviation

<script>
jQuery(document).ready(function($) {
  $('.abbreviated-state-field option').each(function() {
    var stateFullName = $(this).text();
    var stateAbbreviation = getStateAbbreviation(stateFullName);
    $(this).text(stateAbbreviation);
  });

  function getStateAbbreviation(stateFullName) {
    switch (stateFullName) {
      case 'Alabama':
        return 'AL';
      case 'Alaska':
        return 'AK';
      case 'American Samoa':
        return 'AS';
      case 'Arizona':
        return 'AZ';
      case 'Arkansas':
        return 'AR';
      case 'California':
        return 'CA';
      case 'Colorado':
        return 'CO';
      case 'Connecticut':
        return 'CT';
      case 'District of Columbia':
        return 'D.C.';
      case 'Delaware':
        return 'DE';
      case 'Florida':
        return 'FL';
      case 'Georgia':
        return 'GA';
      case 'Guam':
        return 'GU';
      case 'Hawaii':
        return 'HI';
      case 'Idaho':
        return 'ID';
      case 'Illinois':
        return 'IL';
      case 'Indiana':
        return 'IN';
      case 'Iowa':
        return 'IA';
      case 'Kansas':
        return 'KS';
      case 'Kentucky':
        return 'KY';
      case 'Louisiana':
        return 'LA';
      case 'Maine':
        return 'ME';
      case 'Maryland':
        return 'MD';
      case 'Massachusetts':
        return 'MA';
      case 'Michigan':
        return 'MI';
      case 'Minnesota':
        return 'MN';
      case 'Mississippi':
        return 'MS';
      case 'Missouri':
        return 'MO';
      case 'Northern Mariana Islands':
        return 'MP';
      case 'Montana':
        return 'MT';
      case 'Nebraska':
        return 'NE';
      case 'Nevada':
        return 'NV';
      case 'New Hampshire':
        return 'NH';
      case 'New Jersey':
        return 'NJ';
      case 'New Mexico':
        return 'NM';
      case 'New York':
        return 'NY';
      case 'North Carolina':
        return 'NC';
      case 'North Dakota':
        return 'ND';
      case 'Ohio':
        return 'OH';
      case 'Oklahoma':
        return 'OK';
      case 'Oregon':
        return 'OR';
      case 'Pennsylvania':
        return 'PA';
      case 'Puerto Rico':
        return 'PR';
      case 'Rhode Island':
        return 'RI';
      case 'South Carolina':
        return 'SC';
      case 'South Dakota':
        return 'SD';
      case 'Tennessee':
        return 'TN';
      case 'Texas':
        return 'TX';
      case 'Utah':
        return 'UT';
      case 'Vermont':
        return 'VT';
      case 'Virginia':
        return 'VA';
      case 'U.S. Virgin Islands':
        return 'VI';
      case 'Washington':
        return 'WA';
      case 'West Virginia':
        return 'WV';
      case 'Wisconsin':
        return 'WI';
      case 'Wyoming':
        return 'WY';
      case 'Armed Forces Americas':
        return 'AA';
      case 'Armed Forces Europe':
        return 'AE';
      case 'Armed Forces Pacific':
        return 'AP';
      default:
        return stateFullName;
    }
  }
});
</script>

Gravity form radio button design

/* Custom styling for radio buttons in Gravity Forms */
/* Replace 'form-id' with the actual ID or class of your form */

#form-id input[type="radio"] {
  /* Hide the default radio button */
  display: none;
}

#form-id input[type="radio"] + label {
  /* Style the label to resemble a radio button */
  display: inline-block;
  padding: 5px 10px;
  border: 1px solid #ccc;
  border-radius: 4px;
  cursor: pointer;
}

#form-id input[type="radio"]:checked + label {
  /* Style the selected radio button label */
  background-color: #007bff;
  color: #fff;
}


Gravity form repeater field

// Adjust your form ID
add_filter( 'gform_form_post_get_meta_1', 'add_my_field' );
function add_my_field( $form ) {
 
    // Create a Single Line text field for the team member's name
    $name = GF_Fields::create( array(
        'type'   => 'text',
        'id'     => 555, // The Field ID must be unique on the form
        'formId' => $form['id'],
        'label'  => 'Name',
        'pageNumber'  => 1, // Ensure this is correct
    ) );
 
    // Create an email field for the team member's email address
    $email = GF_Fields::create( array(
        'type'   => 'email',
        'id'     => 77, // The Field ID must be unique on the form
        'formId' => $form['id'],
        'label'  => 'Email',
        'pageNumber'  => 1, // Ensure this is correct
    ) );

    // Create a phone field for the team member's email address
    $phone = GF_Fields::create( array(
        'type'   => 'phone',
        'id'     => 777, // The Field ID must be unique on the form
        'formId' => $form['id'],
        'label'  => 'Phone',
        'pageNumber'  => 1, // Ensure this is correct
    ) );
		
    // Create a repeater for the team members and add the name and email fields as the fields to display inside the repeater.
    $team = GF_Fields::create( array(
        'type'             => 'repeater',
        'description'      => 'Maximum of 3 team members',
        'id'               => 585, // The Field ID must be unique on the form
        'formId'           => $form['id'],
        'label'            => 'Team Members',
        'addButtonText'    => 'Add team member', // Optional
        'removeButtonText' => 'Remove team member', // Optional
        'maxItems'         => 3, // Optional
        'pageNumber'       => 1, // Ensure this is correct
        'fields'           => array( $name, $email, $phone ), // Add the fields here.
    ) );
 
    $form['fields'][] = $team;
 
    return $form;
}
 
// Remove the field before the form is saved. Adjust your form ID
add_filter( 'gform_form_update_meta_1', 'remove_my_field', 10, 3 );
function remove_my_field( $form_meta, $form_id, $meta_name ) {
 
    if ( $meta_name == 'display_meta' ) {
        // Remove the Repeater field: ID 1000
        $form_meta['fields'] = wp_list_filter( $form_meta['fields'], array( 'id' => 585 ), 'NOT' );
    }
 
    return $form_meta;
}