Call Javascript function
Question

Is it Correct one?If it is correct then where and how to call that javascript function if i want to execute a set of code repeatdely whenever i clicked a button.

Dear Karthick,

There are many ways how JavaScript can be used in OutSystems. To know about all of them please go through the Master class of java script (Master Class on JavaScript and jQuery Course - Training | OutSystems ).

However to answer your question, assuming that it is a Mobile Application that you are building, as can be seen from your screenshot, do the below steps:

1. Under Interface Tab of Service Studio, scroll down to the end and you will fined "Scripts"

2. Right click on scripts > create script> put the script name>then double click to open the script editor.

3. In the script editor define a JavaScript function and put the code in the function which you want to call repeatedly or re-use. Now close the script editor.

4. Again, under Interface tab, click on the screen in whose action you want to use the function you defined in the previous step.

5. Under the screen properties, there will be a section called "Required Scripts", from the dropdown, add the script that you just created.

6. Now you can call the function defined in the script from the JavaScript Element in any screen action, as you are already doing.

Hope this helps.

Cheers!

Shounak


Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.