Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2020-03-26 20:33:27

hurty
Member
Registered: 2004-07-17
Posts: 26

JavaScript for embedding HTML form in Article not working anymore

I have an article that includes an embedded HTML form from Formsite that stopped working when we upgraded to Textpattern 4.8.

The embed code includes an empty <a> element, a link to the JavaScript on the formsite site that provides the logic, and a short script that should write the content of the form into the the page. This worked prior to upgrading.

<a name='form1070270463' id='formAnchor1070270463'></a>
 <script src='https://fs2.formsite.com/include/form/embedManager.js?1070270463'></script>
 <script>EmbedManager.embed({ key: 'https://fs2.formsite.com/res/showFormEmbed?EParam=m_OmK8apOTB4Lfaz31ox67bfKxI_p1vA&1070270463', width: '100%'});</script>

Any clues about why this stopped working? I should note that when I click on the option to Preview the article or preview the HTML within the TXP admin UI, the form displays as expected. But it doesn’t render in the article when viewing the site itself.

Last edited by hurty (2020-03-26 20:33:53)

Offline

#2 2020-03-26 21:09:13

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 3,810
Website

Re: JavaScript for embedding HTML form in Article not working anymore

Does the browser console (in the web inspector) give you any hints? Does the html source that the page outputs look different/wrong? Are you able to compare an earlier working version with the current output?


TXP Builders – finely-crafted code, design and txp

Offline

#3 2020-03-26 22:20:41

hurty
Member
Registered: 2004-07-17
Posts: 26

Re: JavaScript for embedding HTML form in Article not working anymore

The console reports no errors. The source shows the javascript as expected, but form itself does not render. If I put that same 3 lines of code in a simple plain HTML page, the form renders as expected. The form itself is rendered on that simple plain page inside an iframe. It looks like Textpattern is blocking that iframe.

Offline

#4 2020-03-27 16:12:29

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 3,810
Website

Re: JavaScript for embedding HTML form in Article not working anymore

Hi hurty,

I tried it out with the textpattern demo. It seems textile is converting some quotes in the script causing it not to execute: …width: &#8217;100%’}. This could be a result of updates to textile in the last year or so.

Good news, however: the following two variants work:

<a name='form1070270463' id='formAnchor1070270463'></a>
==<script src='https://fs2.formsite.com/include/form/embedManager.js?1070270463'></script>==
==<script>EmbedManager.embed({ key: 'https://fs2.formsite.com/res/showFormEmbed?EParam=m_OmK8apOTB4Lfaz31ox67bfKxI_p1vA&1070270463', width: '100%'});</script>==

or write notextile. before each of the <script> tags (beginning of the line only) and place a blank line in front of each so that each line is separated. (it didn’t work as a code block here in the forum).


TXP Builders – finely-crafted code, design and txp

Offline

#5 2020-03-31 02:52:04

hurty
Member
Registered: 2004-07-17
Posts: 26

Re: JavaScript for embedding HTML form in Article not working anymore

thank you, Jakob. That worked.

Offline

Board footer

Powered by FluxBB