Javascript not working in your forms? Formidable uses JavaScript extensively to provide a better user experience. Unfortunately, there are many themes and plugins that aren't written to WordPress standards. Some don't include the hooks for loading JavaScript, or they cause JavaScript errors on your site which prevent features like conditional logic, calculations, date fields, etc. from working correctly.
How to fix a JavaScript error
If you are having trouble, the first step is to identify where the issue is coming from. Below are troubleshooting steps that you could follow.
- You can either go through and deactivate your theme and plugins one by one until you find the one causing problems, or use your browser JavaScript error console to point you in the right direction (see below). The most common JavaScript errors originate from themes that do not load jQuery correctly for WordPress. jQuery should never be hardcoded in your theme header but should be loaded with wp_enqueue_script.
- If you have the same form included multiple times on the same page, please note that this isn't currently supported since Javascript-related features won't work correctly.
- If there are no JavaScript errors on your page, your theme may be missing the wp_footer hook.
- If your form is not working properly, jQuery might be loading after the Formidable scripts. Usually, this is only a problem if there are custom jQuery scripts added in the form customized HTML or inside the form. If you run into this issue, you can use a plugin like Simple Custom CSS and JS to add your custom jQuery for the form.
After you find the culprit, you will likely need to contact those who wrote the code and ask them to update it.
How to find JavaScript errors
You can find JavaScript errors in any browser with a variety of tools. Below are links to the Wordpress Codex with instructions on how to find javascript errors with the browser you are using.
If you see the error: "Uncaught ReferenceError: frmFrontForm is not defined" this means the Formidable javascript is failing to load properly. Start by finding the source of the conflict.
If you go through these steps and are not able to solve the problem, please post in the help desk and include a link to your form.
Symptoms of a JavaScript error
There is a wide range of issues you may see if another plugin is causing an error. Here are a few of the most common.
- The fields that should be hidden with conditional logic are shown on page load. In some cases they will hide after making selections in the form.
- The Bootstrap Modal will not open when the link is clicked. Sometimes it may open and show only the grey overlay on the screen.
- The datepicker will not open when clicking on a date field.
- The date field and conditional logic only works on the first form and not on the other forms on the same page.
How to check for AJAX errors
You can find AJAX errors using browser developer tools. These tools have a Network tab that logs the requests made and responses from the call, including AJAX requests. Below are links with instructions on how to monitor the network activity for each browser.
By inspecting the details of each request, you can identify any issues, such as requests that have failed or timed out. If an error is present, you will see the request highlighted in red.