Javascript not working, but only with the Foundry control stack

I’m moving my question from the realmac forum to here because it seems to be a Foundry issue.

Put simply, I have some javascript that is generated by our fund-raising software. When I put it in an HTML stack with nothing else on the page it shows up as intended. But when I put it on a foundry page (one with just the foundry control panel) it disappears. What’s going on? How do I fix this?

Please help.

The web inspector is indicating a javascript error in your custom code it appears:

This could error could be from the code itself, a conflict with other code on the page, it could need a specific version of jQuery and it is colliding with the version Foundry loads, or any number of other things. The error seems to originate, at a cursory glance, at a script you’re loading that is used for resizing iFrames.

Hi @RangeWide,

You could try to isolate the JavaScript from the rest of the Foundry page by using Builder; a free stack from Will Woodgate. This stack allows you to paste JavaScript (and some other code types too) into it. Just put the stack on the spot where you’d want to have the LGL form appear, click the blue ‘+’ button and select “HTML/JavaScript/PHP”. Then paste the LGL JavaScript code into the text box that appears.

This might solve the colliding JS problem that you’re having. On pageload, the JavaScript inside Builder is treated separately from other JavaScript on your page (like Foundry’s). This might be enough for the form to load correctly.

Cheers,
Erwin

Great idea, but alas… it didn’t work. I put the code inside a Builder stack and it still doesn’t show up. Any other ideas? :slight_smile:

I’ve written the company. We’ll see if they are helpful in solving the problem. If not, do you know anyone who might be able to help me solve this? A quick (paid) consult to fix this Javascript so it can work with Foundry?

I don’t personally know of someone that does javascript consultation work, sorry.

Hi @RangeWide

Too bad that it doesn’t work with Builder either.

One other thing to try…

Does the JavaScript code provided by LGL start with <script> and end with </script>?

If so, repeat the steps fro my previous post, but remove both <script> and </script> from the provided code.

Cheers,
Erwin

Thanks for the continued attempt to help. Here’s the code. I’m out of my depth. I don’t know exactly where I’d cut.

<script type="text/javascript" src="https://secure.lglforms.com/form_engine/s/-vj53MOMyItArP8UzM-_1g.js"></script><noscript><a href="https://secure.lglforms.com/form_engine/s/-vj53MOMyItArP8UzM-_1g">Fill out my LGL Form!</a><br/></noscript>```

The company wrote back.

This is a bit beyond what we are able to troubleshoot. Do you have any ajax loading going on? It is possible something like that could be causing a conflict.

Ah… that code loads a JavaScript file from another server. I don’t think you can skip on the <script/> tags here.

My reasoning as that Builder might inject <script> and </script> itself, meaning you get nested script tags, which can cause problems like not displaying content.

I’m afraid I’m out of ideas for now… sorry.

Cheers,
Erwin

I really appreciate your trying so hard. I appear to be out of luck.

1 Like