25
Views
2
Comments
Where to write javascript
Question

This is a basic question. What is the difference between writing JavaScript in a WebScreen and writing it in a WebBlock when working with OutSystems? 

Hey Shin,


If your JavaScript is need in the block, then you should use in Block level. 

If you have multiple blocks used in single screen and some blocks are using JS and some are not, then use it in screen level. 

If you have multiple screens which are using single block, then you should use the JavaScript in block level.

These things are good practice but depending on your usage it may be different.

Thanks & Regards,

Sudip Pal

Champion

Hi Shin, 

Writing JS in Block is desired when you are gonna use that JS at multiple places. It's best practice too because blocks can be reused at different screens or blocks. 


If you need JS just at one screen, you can write it there only. 


Cheers. 

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