Issue with form embedded on static site

By: Patricia Cupra | Asked: 05/04/2022
ForumsCategory: General questionsIssue with form embedded on static site
Patricia CupraPatricia Cupra asked 2 years ago
Hi. I've used this embed code: <script src=""></script> on a static site at (development site, not production) And I'm getting this Console error: === Uncaught TypeError: can't access property "setAttribute", document.getElementById(...) is null <anonymous> line 7 > injectedScript:1 injectScript injectScripts each injectScripts loadDelayedScripts listenForScriptLoad callbackWrapper injectScript injectScripts each injectScripts loadInitialScripts handleReadyStateChange EventHandlerNonNull* <anonymous>   ===   The form still seems to work fine. Is this fixable?   Thanks.
3 Answers
Walter JonesWalter Jones answered 2 years ago
Maybe I am missing something but what are you embedding?  You have script tags with a url, but nothing is being called?  Are you trying to load a form from one site onto another?  Maybe an iframe would be better. 
Victor Font answered 2 years ago

I've never seen that particular method for embedding a form on a 3rd-party WordPress site. Normally, you would use the API,
The JavaScript error you're receiving is because the script is looking for an element with the ID of "ak_js_1". This is not a Formidable generated ID. The injected scipt is not searchable when viewing your page's source code. Whatever the problem is, it's with the script you're embedding from the formfielder site. It needs to be fixed there, or use the API as Formidable's documentation recommends.
document.getElementById( "ak_js_1" ).setAttribute( "value", ( new Date() ).getTime() );

Patricia CupraPatricia Cupra answered 2 years ago
I've followed the instructions exactly from How to Embed a Form on Any Website (Not Only WordPress!) ( It's a relatively new feature.
Victor Font replied 2 years ago

I forgot you could do that with Formidable. Never had a requirement to do this myself. I won't be able to help you with this one.

Making the Best WordPress Plugin even better - Together

Take on bigger projects with confidence knowing you have access to an entire community of Formidable Experts and Professionals who have your back when the going gets tough. You got this!
Join the community