15
Views
11
Comments
Solved
How to incorporate JavaScript in a screen
Application Type
Mobile

Hi,

I am trying to add a timer in my screen and i have zero experience in JavaScript.

With some google search, i was able to find a javascript that gets the job done.

But i dont know how to add this javascript into my page and get a variable to update the starting point of my timer.

Could someone please help me with this please.

Attached the javascript i found below

Timer.js

mvp_badge
MVP
Rank: #72
Solution

Hi,

I'm not sure what exactly your use-case is, but I have tried to create a sample app using the JavaScript shared in the main post.

See this sample app | TimerJSDemo 

Please refer to the attached .oml file


Hope this helps you or at least give you a direction for the final solution.


Kind regards,

Benjith Sam

MobileLabTimerJS.oml

Rank: #8760

This is it. Thanks Benjith for the oml.

I was trying to find the command to pass the output to a container Id and then you send me the complete code. Really appreciate your help.

Thanks

mvp_badge
MVP
Rank: #72

Your are welcome.

Glad to help you :)


Kind regards,

Benjith Sam

Rank: #301

Hi Learn It,

Please refer the below link to get the idea about how to use Java script.

https://success.outsystems.com/Documentation/11/Extensibility_and_Integration/JavaScript/Extend_Your_Mobile_and_Reactive_Apps_Using_JavaScript

Thanks & Kind Regards,

Sachin

Rank: #8760

Thanks Sachin. This looks to be a good document to start.


mvp_badge
MVP
Rank: #17

Hi,

Why don't you make your life more easy and use a Forge component that already encapsulated the Javascript for your?

https://www.outsystems.com/forge/component-overview/2539/javascript-timing-events

Regards,

Daniel

Rank: #8760

I just tried it and for some reason it is not working. When i click on clear interval, nothing is happening.

Even i tried to download some other timer components, but i am getting error with the OutSystems UI version compatibility.

Thanks why i went out for a Javascript.

Appreciate if you can give me some tips on how to use the script i attached .

mvp_badge
MVP
Rank: #17

I've justed them more than once without problem.

What didn't work? Did you get an error message?

Rank: #8760

The moment i click on clear interval, the Counter just stucks and doesnt do anything. i have go refresh the page to restart the counter again



Rank: #8760

On Top of this, i am getting error while trying to download this application from forge

Is it safe to forceinstall this tool? as i dont want to messup my applications

mvp_badge
MVP
Rank: #17

This component just encapsulates plain javascript in OutSystems actions and blocks.

The reason you get the warning is becuase it was published under version 10 of OutSystems.
Hence the warning: JavaScript Timing Events may be incompatible with your platform version.

It is safe to install in your environment.

I will ask the component owner if it can be republished for version 11.


mvp_badge
MVP
Rank: #72
Solution

Hi,

I'm not sure what exactly your use-case is, but I have tried to create a sample app using the JavaScript shared in the main post.

See this sample app | TimerJSDemo 

Please refer to the attached .oml file


Hope this helps you or at least give you a direction for the final solution.


Kind regards,

Benjith Sam

MobileLabTimerJS.oml

Rank: #8760

This is it. Thanks Benjith for the oml.

I was trying to find the command to pass the output to a container Id and then you send me the complete code. Really appreciate your help.

Thanks

mvp_badge
MVP
Rank: #72

Your are welcome.

Glad to help you :)


Kind regards,

Benjith Sam