Javascript implementation

Javascript implementation

  

Hi,

I would like to know how to implement the following javascript code exactly in outsystems. I want to know how to use getElementById and the empty paragraph block. Please help me in building this code (if possible requesting developed .oml file) 



<html>
<body>

<h2>JavaScript Arrays</h2>

<p id="demo"></p>

<script>
var cars = ["Saab", "Volvo", "BMW"];
document.getElementById("demo").innerHTML = cars;
</script>

</body>
</html>
 

Hello Kuruma,

Here' a sample OML with two possible approaches: the first one using an unescaped expression for both the HTML and JavaScript, and the second one just for the JavaScript.

Hi Kuruma,

I'm a bit at loss why you are asking this. Are you a JavaScript developer that is told to use OutSystems? Are you converting an existing application from JavaScript to OutSystems? If the latter, do you know what the code does? If so, why don't you know how to handle this in OutSystems? Where is the data ("Saab", "Volvo", "BMW") coming from? A database? Is it static?

And, always an important question, have you taken the online courses?

Kilian Hekhuis wrote:

Hi Kuruma,

I'm a bit at loss why you are asking this. Are you a JavaScript developer that is told to use OutSystems? Are you converting an existing application from JavaScript to OutSystems? If the latter, do you know what the code does? If so, why don't you know how to handle this in OutSystems? Where is the data ("Saab", "Volvo", "BMW") coming from? A database? Is it static?

And, always an important question, have you taken the online courses?

Hi Kilian,

Yes I have gone through online courses. I'm trying to implement some javascript code functionalities in my project. But some how I am getting stopped whenever I come to the point to use "getelementbyId". I would like to know how it is used. Though it is mentioned in the documents but the way it mentioned to use is not suitable to use in my code.So posted a question to know more about that with an example.



Aurelio Junior wrote:

Hello Kuruma,

Here' a sample OML with two possible approaches: the first one using an unescaped expression for both the HTML and JavaScript, and the second one just for the JavaScript.

Thank you Aurelio Junior for sending the file. Hope this information may useful to me for building up my code.


Hi Kuruma,

Basically, when you are working with OutSystems, you do not use JavaScript (unless you are creating some reusable components similar to RichWidgets or SilkUI or the like).

All that your JavaScript code does is display a list of elements as a comma seperated list on the screen. To do the same with OutSystems is very basic (hint: use a ListRecords Widget), so that's why I was wondering whether you did the online courses.