Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions craft-freeform/developer/js-plugin.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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)`<Badge type="feature" text="New in 5.5.3+" /> - 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()`<Badge type="recommended" text="Recommended" /><Badge type="feature" text="New in 5.5.4+" /> - capable of generating any of Freeform's scripts when you specify them.
- Options are:
Expand Down Expand Up @@ -144,7 +146,7 @@ If you wish to generate Freeform's main scripts, the JS Test, reCAPTCHA v3 and S
</TabItem>
</Tabs>

### `loadFreeformPlugin()` and `loadFormSpecificScripts()` Example
### `loadFreeformPlugin()`, `loadFreeformPluginJs()`, `loadFreeformPluginCss()` and `loadFormSpecificScripts()` Example

<Tabs>
<TabItem value="ff-manual-js-loadffplugin-example" label="Example Code" default>
Expand All @@ -153,7 +155,9 @@ If you wish to generate Freeform's main scripts, the JS Test, reCAPTCHA v3 and S
<body>
{# your template code #}

{{ freeform.loadFreeformPlugin }}
{{ freeform.loadFreeformPlugin }} // or
{{ freeform.loadFreeformPluginJs }} // and
{{ freeform.loadFreeformPluginCss }}
{{ freeform.loadFormSpecificScripts(form) }}
</body>
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down