Hi Robert,
A Javascript variable is a client side variable that is being stored in the client browser, while an Application variable is a server side variable that is avaiable in the scope of an OutSystems action on the server when the web request is being process. The way to pass a variable on the client to the server, is to make sure that you put it in an input in the form that will be submitted to the server.
For example, to have a Javascript variable
string NameJS on your screen passed to the OutSystems local WebScreen variable
text NameOS, you must do the following:
- Create a hidden Input in your screen (it can be a text box) and give it a name (eg. NameInput);
- Bind the OutSystems local variable NameOS to the NameInput;
- Make sure that your Javascript logic writes the value of the NameJS Javascript variable to the NameInput (remember that you have the OutSystems runtime property NameInput.Id in your input that gives you the DOM Id of the OutSystems input in runtime so that you can use it in your Javascript logic);
- Once the form is submitted to the server (with a button or link), you will have available the NameInput value available in the NameOS local variable. As your javascript logic is writing the NameJS value to the NameInput, this means you will have have achieved your goal - the NameOS variable is holding the value of the NameJS variable.
Kind Regards,
Daniel Lourenço
OutSystems
Can you please send us an example oml because i have tried it many times but is not working with me