Sonas Wedding Venue Form app not working in conditional

Hi, just checking if anyone has some advice for me on this, I have to implement Sonas Events as a form provider into my existing site built with NodeJS, the current Wappler built form is inside a Partial

The script they have asked me to insert on my page is

<div class="sonas-form" data-form-id="XCDummyDataHereS8" data-tenant-id="h4XDummyDataHerejau"></div>
<script type="text/javascript" src="https://app.sonas.events/formswidget.min.js" defer async></script>

When I save/deploy this, i do not see any form on my page at all


Just a loader and then nothing.

I have tried moving the script part, into the head, at the end of the body, as well as inline with the form, all produce the same result of no form displayed. If i take out the conditional region then it displays perfectly.

Is there a way to make the script only start running once the conditional has evaluated to true or something to get around the issue.

Have you tried with the script inside the conditional region? Haven’t reviewed the script content but it probably is running immediately and if your form div is in a conditional then it won’t be found by the script. But if the script is also in the conditional it won’t run until expression is true.

1 Like

Have you tried adding the attribute notnow also?

<script type="text/javascript" src="https://app.sonas.events/formswidget.min.js" defer async notnow></script>

You really don’t want that script to load huh? :smiley:

Are you keeping defer for fall back?
If you include both async and defer on a <script> tag, the async attribute will take precedence if the browser supports it. If the browser doesn’t support async , it will fall back to defer .

1 Like

Yeah, that was my first try, in fact its what it is currently on that page Ken, would you mind taking a little look and seeing if you can figure out some trickery to do a parse or something after its loaded, I am busy reading a post from you on some of your previous exploits on this type of thing.

Sure, after :coffee:

1 Like

Lol, Jon, just added a notnow to it, alas still not loading.

You give me too much credit, I am not that smart, I was on Sonas, I asked for the code to add the form to my website, they gave me that exactly, and i pasted it exactly, lol.
They say defer, i say yes, they say async, i say yes… hahaha

1 Like

I seem to recall a post where Patrick said a conditional is loaded and then removed from the DOM or something like that, so wondering how that effects this.

Check the dev console to see when the script is retrieved from the remote site.

Seems to be loading after all the core Wappler components, such as AppConnect, but the load has far more content included in it such as all the form fields, which do not show up in the DOM itself, so i assume the conditional is dropping all its content and can not reload it or something.

Out of interest, In Safari browser the form does load, but not Google Chrome, hmmm @Teodor, any ideas.

Please ignore how ugly the form is, I will make it pretty once i get it working.

Sorry, I gots nothin’ :man_shrugging:

1 Like

Lol, thank you for trying Ken, if you and Jon couldn’t work it out then I don’t feel quite as silly. @patrick any hint what to attempt here.

Jon is enjoying camping in the middle of a storm :joy:

2 Likes

Anyone, got any other ideas here before I start restructuring the site to change all the conditional regions into show/hide instead? @Teodor

I don’t really have any idea what could be wrong here, as this is some 3rd party script, but why would you have it in a conditional region? It’s a contact page that shows a contact form. Why make the form conditional?

1 Like

Its because there are a few different contact forms, and depending on if they came from a google adwords campaign, or an affiliate link I have to show them either this form or that form, all depending upon browser referrers.
I will make them into show hides for now to get around it, thank you for checking though, it could have been something simple i did wrong.

Just an update, swapping from a conditional region to a dmx-show fixed the issue right away.

3 Likes