Developer forum

Forum » Dynamicweb 10 » function is not defined

function is not defined

Soe Moe Tun
Reply

Dear Dynamicweb,

javascript function on 'injected screen view cshtml' is getting 'Uncaught ReferenceError: function is not defined'.

Thanks

not_defined.png

Replies

 
Nicolai Pedersen Dynamicweb Employee
Nicolai Pedersen
Reply

Hi

Can you share some of your code so we can see what you are doing?
Seems like you are calling a custom JS method - and how and where is that injected?

Did you follow the examples from here: https://github.com/dynamicweb/Summit2022_ExtendingTheUI/tree/step4

BR Nicolai

 
Soe Moe Tun
Reply

Dear Nicolai,

Yes, it is calling a custom JS method. And we followed the example from Github.

We are trying to upgrade from DW9 to DW10 where we would like to reuse the design and javascript functions in the custom module app from DW9 to DW10. We created an overview screen without any UiComponent, and injected the custom cshtml there. 

The screen is properly shown, inline css style are working fine, but javascript functions are not. It got 'function is not defined'.
Thus, we also tried on the example one from Github, and got same result.

Thanks

 

 
Soe Moe Tun
Reply

Hello, 

Any update on this, please?

Thanks

 
Jeppe Eriksson Agger Dynamicweb Employee
Jeppe Eriksson Agger
Reply

Hi,

Browsers have gotten more restrictive with what they allow to execute. Adding new HTML to the DOM the way we do does not make script blocks executable. It used to work in previous versions of browsers, but in newer versions, it has apparently been disabled.

We are investigating how to best support custom components with custom JavaScript, but for now, we don't have a solution.

- Jeppe

 
Soe Moe Tun
Reply

Hi Jeppe,

Noted with thanks.

BR Oliver

 

You must be logged in to post in the forum