Javascript replace value of input
Show you can not change the local variables by javascript while on-screen elements(HTML tag like input) we can change the value via javascript. To change the value in the local variable you have to assign value anyhow on the screen action. Hi Filipe, If you assign a value on basis of Js, there are two approaches you can follow i) If your using the script in any client action just set one Output parameter for the script with the respective value assigned, and assign that Output parameter to the local variable on the next step. ii) If you're passing the value from web block using trigger event, In the event handler of the screen assign the local variable with the value. Hope it helps! Regards, Saravanan Santhanam. " If your using the script in any client action just set one Output parameter for the script with the respective value assigned, and assign that Output parameter to the local variable on the next step. " The local variable and the input is in the screen, not in the webblock, in the webblock I have placeholders Can you pls share any screenshot or sample oml to understand, how you set the value for the input widget? Geting the objects Setting the value:
Are you trying to do this for educational purposes ? Because i am very curious as to why you want to resort to javascript for something OS offers you in client actions (which is better maintainable than JS). No. I am trying to create a widget with the possibility of the input and textarea in the calling side. If you know how to do it with Outsystems client actions , please go forward, how to set inside the webblock something that is outside? I am not sure what you mean by this. You can now access the value through the local variable, but this does not work for you? I did create a formatmask for inputwidgets once. For his you need javascript, but even then i try to only use js to create events. And the logic i still put inside client actions and call them from js. Are you trying something similar? I think you didn't understand , the input is in a screen and the widget is a webblock (where I am trying to set the value of the input) , how do you access the local variable that is in the screen inside the webblock? To have the input in your screen changed when something in your webblock changes, you can create an event and trigger it. then handle that event in your screen. Example: 1: the input on the screen 2: the webblock. and the raiseeventclick action in the webblock: you can not change the local variables by javascript while on-screen elements(HTML tag like input) we can change the value via javascript. To change the value in the local variable you have to assign value anyhow on the screen action. DescriptionReplace input text value by text in a string Demo CodeResultView the demo in separate window <html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript"> function edValueKey(e)/*from www . j av a2s. c o m*/ { var monTexte = 'This is my test'; var my = document.getElementById("edValue").value; my = my.length + 1; document.getElementById("edValue").value = monTexte.substr(0, my); e.preventDefault(); } <body> <input id="edValue" type="text" onKeyPress="edValueKey(event)"> |