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 3 years ago
Hi. I've used this embed code: <script src="https://formfielder.com/frm_embed/kkp"></script> on a static site at https://38105-old-pond.site.hardypress.com/ (development site, not production) And I'm getting this Console error: === Uncaught TypeError: can't access property "setAttribute", document.getElementById(...) is null <anonymous> https://38105-old-pond.site.hardypress.com/contact/ line 7 > injectedScript:1 injectScript https://formfielder.com/frm_embed/kkp:7 injectScripts https://formfielder.com/frm_embed/kkp:5 each https://formfielder.com/frm_embed/kkp:8 injectScripts https://formfielder.com/frm_embed/kkp:5 loadDelayedScripts https://formfielder.com/frm_embed/kkp:4 listenForScriptLoad https://formfielder.com/frm_embed/kkp:5 callbackWrapper https://formfielder.com/frm_embed/kkp:7 injectScript https://formfielder.com/frm_embed/kkp:7 injectScripts https://formfielder.com/frm_embed/kkp:5 each https://formfielder.com/frm_embed/kkp:8 injectScripts https://formfielder.com/frm_embed/kkp:5 loadInitialScripts https://formfielder.com/frm_embed/kkp:4 handleReadyStateChange https://formfielder.com/frm_embed/kkp:5 EventHandlerNonNull* https://formfielder.com/frm_embed/kkp:2 <anonymous> https://formfielder.com/frm_embed/kkp:8   ===   The form still seems to work fine. Is this fixable?   Thanks.
3 Answers
Walter JonesWalter Jones answered 3 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 3 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, https://formidableforms.com/knowledgebase/formidable-api/#kb-show-a-form-on-another-wordpress-site.
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 3 years ago
I've followed the instructions exactly from How to Embed a Form on Any Website (Not Only WordPress!) (formidableforms.com) It's a relatively new feature.
Victor Font replied 3 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
crossarrow-right