Javascript error on contact page with form

I am getting a javascript error on contact page with form and unsure how to resolve it - Uncaught ReferenceError: dmx is not defined
see attchedjava%20error

Check if dmxAppConnect.js in included on the page before dmxValidator.js.

I think I need to start from scratch again – here is script

Doesn’t look right to me – sorry my coding is limited

Norm

(Attachment head.txt is missing)

If you still having trouble with this maybe you could supply a screenshot of the head section of the code to help us figure out what the problem could be.

I did send screenshot – I have attached again – let me know if u do not get it

norm

You are missing App Connect which is required, just add the App Connect framework to the page and it should work.

If you need to know how, it is here in the docs How to add App Connect framework to your page

Thanks, that was it. Thought it was on page already, I now know what to check for moving forward.

norm

Hello, I got the same problem in ejs page. AppConnect is installed but get Uncaught Reference Errror:

The test page:

<!-- Wappler include fontawesome_5="cdn" bootstrap5="local" id="show3" components="{dmxStateManagement:{}}" is="dmx-app" appConnect="local" -->
<dmx-value id="var1" dmx-bind:value="'hello'"></dmx-value>
<meta name="ac:route" content="/show3">
<dmx-session-manager id="session1"></dmx-session-manager>


<p>Il valore della variabile TestVar è: <span id="value"></span></p>

<script>
    // Definisci la variabile TestVar
        var TestVar = dmx.parse('content.var1.value');

        // Ottieni il riferimento all'elemento <span> nel DOM
        var valueSpan = document.getElementById("value");

        // Stampare il valore della variabile TestVar nell'elemento <span>
        valueSpan.textContent = TestVar;
</script>

Here what I get:

I tried both with content page or page without layout…
Where am I wrong @patrick?

The error means that App Connect is not available, probably the file dmxAppConnect.js was not included or missing.

Seeing your test page it is a content page, this means it is only a part of the full page and there should be a main page that has the includes. I don’t see a reference to the main page in the include comment, did you setup the page correctly?

@patrick, here the layout page, app connect is included: (it happens to me also in other website)

<!doctype html>
<html>

<head>
  <base href="/">
  <script src="/dmxAppConnect/dmxAppConnect.js"></script>
  <meta charset="UTF-8">
  <title>Untitled Document</title>

Check in the App Properties if the Layout Page is defined, seeing your test page it seems that it isn’t.

image

@patrick, I have the same problem both on page where layout page are defined and where not. I tried both. Not only. The same problem persist in different websites I have

Screenshot 2024-03-11 alle 15.49.31

<!-- Wappler include head-page="layouts/main" fontawesome_5="cdn" bootstrap5="local" is="dmx-app" id="index" appconnect="local" components="{dmxStateManagement:{}}" -->
<dmx-value id="var1" dmx-bind:value="12345"></dmx-value>
<dmx-session-manager id="session1"></dmx-session-manager>
<meta name="ac:route" content="/show2">
<script>
    // Definisco variabile globale  Keyname




let myVar = dmx.parse('var1.value');
    console.log(myVar);


</script>
<div class="container">
    <div class="row">
        <div class="col">
            <p>{{session1.data.keyname}} </p>
        </div>
    </div>
    <div class="row">
        <div class="col" id="adobedcview" style="height: 80vh; width: 80vh;"></div>
    </div>
</div>

Well most probably this is a timing issue. You’re calling your js function before app connect loads. You need to make sure your js code is executed after App Connect is loaded.

Dear @Teodor and @patrick,
thank you very much for your help. It worked.
The only thing is that APP ready works only if used in layout page. It was timing problem.
Just some modification to the script and the Adobe PDF Embed Api works very nicely in the webpage.