From af3db02eaa2baa2ae2e8c67cb14273beb7a68424 Mon Sep 17 00:00:00 2001 From: Sean Delaney Date: Fri, 31 Oct 2025 14:52:16 +0000 Subject: [PATCH] feat(SFT-2451): added new loadFreeformPluginJs and loadFreeformPluginCss functions --- craft-freeform/developer/js-plugin.mdx | 8 ++++++-- .../guides/guide/troubleshooting-form-issues.mdx | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/craft-freeform/developer/js-plugin.mdx b/craft-freeform/developer/js-plugin.mdx index 78945b0..fc1955b 100644 --- a/craft-freeform/developer/js-plugin.mdx +++ b/craft-freeform/developer/js-plugin.mdx @@ -85,6 +85,8 @@ You can add your custom form handler scripts anywhere in the page. The `freeform If you wish to manually load the Freeform JS elsewhere in your template (rather than having Freeform automatically insert it inside the Freeform form or in the page footer), be sure to select the `None` option for the [Script Insertion Location](../configuration/settings.mdx#general-settings) setting. Then, you'll need to add the `freeform.loadFreeformPlugin()` function to your template where you'd like it to insert the JS. You can pass two variables to the function to add custom attributes to the script and style tags that Freeform generates. - `freeform.loadFreeformPlugin()` - will load Freeform's global `freeform.js` and `freeform.css` files. +- `freeform.loadFreeformPluginJs()` - will load Freeform's global `freeform.js` file. +- `freeform.loadFreeformPluginCss()` - will load Freeform's global `freeform.css` file. - `freeform.loadFormSpecificScripts(form)` - will load form-specific scripts such as **reCAPTCHA** and the **JS Test** scripts, where applicable. Be sure to pass the form to this function. If `form` is already defined, you can use that. - `freeform.loadScripts()` - capable of generating any of Freeform's scripts when you specify them. - Options are: @@ -144,7 +146,7 @@ If you wish to generate Freeform's main scripts, the JS Test, reCAPTCHA v3 and S -### `loadFreeformPlugin()` and `loadFormSpecificScripts()` Example +### `loadFreeformPlugin()`, `loadFreeformPluginJs()`, `loadFreeformPluginCss()` and `loadFormSpecificScripts()` Example @@ -153,7 +155,9 @@ If you wish to generate Freeform's main scripts, the JS Test, reCAPTCHA v3 and S {# your template code #} - {{ freeform.loadFreeformPlugin }} + {{ freeform.loadFreeformPlugin }} // or + {{ freeform.loadFreeformPluginJs }} // and + {{ freeform.loadFreeformPluginCss }} {{ freeform.loadFormSpecificScripts(form) }} ``` diff --git a/craft-freeform/guides/guide/troubleshooting-form-issues.mdx b/craft-freeform/guides/guide/troubleshooting-form-issues.mdx index 2ed0f00..a4dc031 100755 --- a/craft-freeform/guides/guide/troubleshooting-form-issues.mdx +++ b/craft-freeform/guides/guide/troubleshooting-form-issues.mdx @@ -20,7 +20,7 @@ This guide walks you through troubleshooting and diagnosing some of the most com Some of the most common issues in Freeform are related to the following: - A newer version of Freeform resolves the issue. Please make sure you're using the latest version of Freeform, or at least check the [Changelog](../../setup/changelog.mdx) to see if any relevant items have been fixed in newer versions. - - The [Freeform Script Insert Location](../../configuration/settings.mdx#script-insert-location) setting is set to `Manual`. Most sites should use `Page Footer`, but in some cases it may be necessary to load these manually. If you must use `Manual`, please make sure you're loading Freeform's scripts in your forms with `freeform.loadScripts()`. Please see the guide in the [JS Plugin documentation](../../developer/js-plugin.mdx#loading-freeform-js-manually) for more info. + - The [Freeform Script Insert Location](../../configuration/settings.mdx#script-insert-location) setting is set to `Manual`. Most sites should use `Page Footer`, but in some cases it may be necessary to load these manually. If you must use `Manual`, please make sure you're loading Freeform's scripts in your forms with `freeform.loadFreeformPlugin()`. Please see the guide in the [JS Plugin documentation](../../developer/js-plugin.mdx#loading-freeform-js-manually) for more info. - There's an issue that Freeform has logged in the [Error Logs](../../configuration/settings.mdx#error-log). Freeform will sometimes log issues it discovers in its own error log file. Check out this area and see if there are any clues as to what might be causing the issue. - A custom module for Freeform is not working correctly or an unrelated module is interfering with Freeform.