Expand my Community achievements bar.

Global Method

Avatar

Level 2
I need to do similar functionality for 2 or more Controls

For eg.,

I have 3 Text Box. On Exit of these 3 Text Box, I need to display same Message.



Can I write a Global Scripting Function and call it in all the 3 Text Boxes?



if so, Can you please explain the same...
1 Reply

Avatar

Level 2
You can create a new Script Object at form-level. (Right click on the form and select "Insert Script Object")

Next give the new object a proper name (e.g. GlobalFunctions)

In the Script Object you can enter your scripts like you are used to do within control-event (unless you are using FormCalc as script-language, because script objects only allows JavaScript). However it is now a function instead of a event, so you need to make a function of it. E.g:



function DoSomething(SomeParameter) {

return "I have done something";

}



Now you can call it from any control by using the script objects name and the function you would like to call. E.g.:



GlobalFunctions.DoSomething("blabla");