No puedo acceder a ninguna propiedad o funcion de document javascript en el editor de template inferior.



  • Hola, porque al momento de editar un template, en la parte inferior tengo para cargar javascript no puedo acceder a document, me sale que document no esta definido.

    Hello, because when I edit a template, at the bottom I have to load javascript I can not access the document, I get that document is not defined.

    Error while executing templating engine. document is not defined. Error on line 18:5.
    
      16 |     father = '<div class="container-heatmap">';
      17 |     config = _config1;
    > 18 |     element = document.getElementById(config.idElement);
         |     ^
      19 |     // element.innerHTML = 'Loading ... ';
      20 |     // element.className = 'container-heatmap';
      21 |     color = config.color.split('(')[1].split(',')[0];

  • administrators

    hi! your templates executes in the server not in the browser, so document is not defined in server context.

    you are probably trying to generate some dynamic content using browser apis but you need to understand where to put that code, remember that in a web page that code should be inside a script tag, probably because some confusion you are trying to use document inside helper or somewhere else that has only server context.



  • Please use just English. Including the topic titles.
    We will delete the future non-English posts.


Log in to reply
 

Looks like your connection to jsreport forum was lost, please wait while we try to reconnect.