0

Can I use ONTRAform code in a Divi Code Block? [closed]

I use Divi, a theme from Elegant Themes on one site, and Divi Builder in other themes by them. It has a "code block" that is supposed to work with JavaScript code. But when I put the code for my ONTRAform in a code block, it remains blank!

edit retag flag offensive reopen merge delete

Closed for the following reason duplicate question by Frank
close date 2016-11-22 11:24:25.902639

1 answer

Sort by ยป oldest newest most voted
0

ONTRAPORT uses single quote marks in it's JavaScript code, like this:

<script type='text/javascript' async='true' src='https://app.ontraport.com/js/ontraport/opt_assets/drivers/opf.js' data-opf-uid='p2c83585f36' data-opf-params='borderColor=#fff&borderSize=5px&embed=true&formHeight=761&formWidth=480px&popPosition=mc&instance=549867860'></script>

Divi uses single quotes in their function that is calling the code block, so it fails. If you have a JavaScript programmer available, you can have him switch the ONTRAPORT JavaScript code to use double quotes. This isn't as simple as it seems, and should be done by someone familiar with programming in JavaScript. In addition to simply replacing each single quote with a double quote, the programmer will have to be able to recognize when a single quote is intended to be in the output and is "escaped" in the code, such as in the string 'Bob/'s your uncle'. The programmer will know how to handle that, and will also recognize when a double quote already in the code will need to be escaped. Fortunately, in the example code block shown here, we can simply replace single quotes with double quotes and try it. Copy the JavaScript to a text editor and make the changes. It now looks like this:

<script type="text/javascript" async="true" src="https://app.ontraport.com/js/ontraport/opt_assets/drivers/opf.js" data-opf-uid="p2c83585f36" data-opf-params="borderColor=#fff&borderSize=5px&embed=true&formHeight=761&formWidth=480px&popPosition=mc&instance=549867860"></script>

Try the newly edited code in the Divi code block and see if it renders the form correctly. Like anything in the "custom coding" realm, we cannot guarantee results, and cannot do any custom coding for you.

edit flag offensive delete publish link more

Question Tools

1 follower

Stats

Asked: 2016-03-16 09:29:31 -0700

Seen: 62 times

Last updated: Mar 16 '16