Search
Close this search box.
Search
Close this search box.

Gravity Forms

Gravity Forms Add-ons

How to send an email notification to a logged user that submits the form

Just enter the following merge tag at the Send to Email field in the notification.

{user:user_email}

How to style the {all_fields} email template

You can use the plugin shown here.

How to Prevent Gravity Forms Entry Creation

While you can’t currently prevent Gravity Forms from creating an entry (and you may not want to just in case it breaks something else that needs the entry information in the course of processing the form submission), you *can* delete the entry after the form has finished submitting using the gform_after_submission_{$form[‘id’]} action hook and the Gravity Forms API.

So, if your form ID is 10, your code would be:

add_action( 'gform_after_submission_10', 'mysite_gform_after_submission_10', 10, 2 ); function mysite_gform_after_submission_10 ( $entry, $form ) {
GFAPI::delete_entry( $entry['id'] );
}

How to Allow Editors to Access Gravity Forms in WordPress (Or Assign Any Capability to Any User Role)

Just download and activate this plugin. Work done!

How to change the email sent by gravity

Check here.

How to disable past dates on date pickers

Just use this code:

<script>
    $(function (){
        $(".datepicker").datepicker({ minDate: 0 });
    });
</script>

Don’t forget to set the correct date format, because it will change due to datepicker function.

How to change the date format globally

<script>
    $(function (){
        $(".datepicker").datepicker({ dateFormat: 'dd/mm/yy' });
    });
</script>

How to disable specific weekdays

$(".datepicker").datepicker('option','beforeShowDay',disableSpecificWeekDays);

function disableSpecificWeekDays(date) {
    // 0 = monday, 1 = tuesday, 2 = wednesday, 3 = thursday,4 = friday, 5 = saturday, 6 = sunday
    var daysToDisable = [2, 4, 5];
    var day = date.getDay();
    for (i = 0; i < daysToDisable.length; i++) {
        if ($.inArray(day, daysToDisable) != -1) {
            return [false];
        }
    }
    return [true];
}