Tag Archives: gravityforms

Gravity Forms – Disable and Remove the “Map It” Link

In the Gravity Forms generated emails, if your form has a “address” field the email notification generated by using something like {all_fields} will have a “Map It” link associated with the address, which will open Google Maps. Add this code to your theme’s functions.php file to disable / remove the “Map It” link from the email notification. // code courtesy of https://techblog.willshouse.com/?p=5249 add_filter(“gform_pre_send_email”, array($this,’gform_pre_send_email’)); function gform_pre_send_email($email) { // attempt to match the link using a regular expression $test = preg_replace(“#\<a [^>]+?\>Map It[^>]+\>#i”, ”, $email[“message”]); // if the result is not empty / blank, use it to replace the original html if(trim($test)) { $email[“message”] = $test; } return $email; } If you want to hide the “map it” link from the HTML that is displayed on a webpage ( if you confirmation has the {all_fields} merge replacement in it ) then you can add some CSS like this: <style> a.map-it-link { display: none; } </style></a>

Posted in Tech Tips, Web Development | Tagged , | 2 Comments

Gravity Forms: Prevent Scrolling on Next / Previous Ajax Submits

Step 1: Identify your Form ID Figure out what your form ID is – look in the address bar as you edit your form: Step 2: Add a Filter Edit something like your theme’s functions.php file and add a filter for the form number: add_filter(‘gform_confirmation_anchor_5′,’theme_gform_confirmation_anchor_5′); function theme_gform_confirmation_anchor_5($enabled) { return false; } Step 3: Done Now the code in the gravity forms plugin won’t fire that causes the form to scroll on ajax submits of multi-paged forms. (no need to change this, code for reference only): if($use_anchor !== false) { $scroll_position[‘default’] = is_numeric($use_anchor) ? “jQuery(document).scrollTop(” . intval($use_anchor) . “);” : “jQuery(document).scrollTop(jQuery(‘#gform_wrapper_{$form_id}’).offset().top);”; $scroll_position[‘confirmation’] = is_numeric($use_anchor) ? “jQuery(document).scrollTop(” . intval($use_anchor) . “);” : “jQuery(document).scrollTop(jQuery(‘#gforms_confirmation_message’).offset().top);”; } Step 4: Replace scrolling behavior with something like jQuery Smooth Scroll Use code similar to this to scroll to a certain element after one of the submit buttons has been clicked: <script src=”//cdnjs.cloudflare.com/ajax/libs/jquery-smooth-scroll/1.4.12/jquery.smooth-scroll.min.js”></script> <script> jQuery(document).on(‘click’,’.gform_page_footer input’, function() { jQuery.smoothScroll({ scrollTarget: ‘.gform_wrapper’, offset: -20 }); }); </script>

Posted in Tech Tips | Tagged , | 1 Comment

“gform_load_form_settings” is deprecated on this page since version 1.7

Recently after upgrading GravityForms I started seeing the message: > Gravity Forms API warning: The jQuery event “gform_load_form_settings” is deprecated on this page since version 1.7 The following are Form Settings related hooks that have been deprecated: gform_properties_settings: You should now use gform_form_settings. gform_advanced_settings: You should now use gform_form_settings. gform_confirmation_settings: You should now use gform_confirmation_ui_settings. gform_load_form_settings JS: This jQuery hook has been deprecated when used on the Form Editor as Form Settings are no longer located there. If you rely on this hook on the Form Editor you should use the gform_load_field_settings jQuery hook instead. When using this hook on the Form Settings page, the hook is still valid. gform_before_update JS: You should now use thegform_pre_form_settings_save hook to handle updates on the new Form Settings page or gform_pre_form_editor_save jQuery hook to handle updates on the Form Editor page. For more deprecated functions check out the dev notes.

Posted in Tech Tips, Web Development | Tagged | Leave a comment

GravityForms: tw-sack.min – Uncaught SyntaxError: Unexpected identifier tw-sack.min.js:1

Here is what the error looks like in the Chrome Debugger Console: Uncaught SyntaxError: Unexpected identifier tw-sack.min.js:1 If you’r getting a problem with editing forms in GravityForms, or perhaps trying to add fields, you can take a look at the source code and you’ll see what happens – an AJAX request is made, but twsack does not like the response which looks something like: EndAddField({“id”: 1, “label”: “Hidden Field”, “adminLabel”: “”, “type”: “hidden “, “isRequired”: false, “size”: “medium”, “errorMessage”: “”, “inputs”: null}, ” <li id=’field_1′ class=’selectable gfield gform_hidden’ ><div class=’gfield_ admin_icons’><div class=’gfield_admin_header_title’>Hidden : Field ID 1</div><a class=’field_delete_icon’ id=’gfield_delete_1′ title=’click to delete this field ‘ rel=’nofollow’ href=’#’ onclick=’StartDeleteField(this); return false;’>Delete</a><a class=’f ield_duplicate_icon’ id=’gfield_duplicate_1′ title=’click to duplicate this fiel d’ rel=’nofollow’ href=’#’ onclick=’StartDuplicateField(this); return false;’>Duplicate</a><a c lass=’field_edit_icon edit_icon_collapsed’ title=’click to edit this field’>Edit </a></div><label class=’gfield_label’ for=’input_1′>Hidden Field</label><input p laceholder=”Hidden Field” name=’input_1′ id=’input_1′ type=’text’ value=” dis abled=’disabled’/></li>”);m So the problem is actually that the response comes back with a Content-type of json, javascript, or html when it should be returned as text/plain – something like: Content-Type: text/html; charset=UTF-8 To test, I edited the file form_detail.php and changed line 2178 (or rather inserted this line) – for gravity forms 1.7.5 (omit the line numbers): 2178 header(‘Content-type: text/html; charset=utf-8’); 2179 die(“EndAddField($field_json, \”$field_html\”);”); Next I am going to look into changing the .htaccess file for this system to see about editing the default content type which I think is causing the root of the error. Update Looks like the content type was a fix but it … Continue reading

Posted in Tech Tips | Tagged , | 3 Comments

MailChimp for Gravity Forms: Ajax error while selecting a form

If you’re using MailChimp Add-On v1.7 with Gravity Forms 1.6 in WordPress, and trying to set up a MailChimp Feed on the page /wp-admin/admin.php?page=gf_mailchimp, you may possibly be getting the following error: Ajax error while selecting a form This plugin is supposed to be easy to set up forms and lists with MailChimp, but why am I getting a Server 500 error? I looked into the PHP error logs and came across this: PHP Fatal error: Call to undefined method MCAPI::listInterestGroupings() in wp-content/plugins/gravityformsmailchimp/mailchimp.php on line 1123 There is a listInterestGroupings() function but the calling function which uses this code: $api = self::get_api(); self::log_debug(“Retrieving groups”); $groupings = $api->listInterestGroupings($selected_list_id); Is having trouble with it. The workaround for me was to comment out line 1123 which contains: $groupings = $api->listInterestGroupings($selected_list_id); The next part of the function has an if(!empty()) conditional. So until the developers get around to fixing this bug this seems to allow me to move on to the next steps with my Mailchimp widget.

Posted in Linux, Tech Tips, Web Development | Tagged , , , , | 1 Comment