Hi Cristovao!
You can change the trigger delay of an "On Change", by setting the osOnChangeTimerDelay javascript variable.
The default value is 800, that corresponds to a delay of 800 ms after the user stops typing.
To change this value to 3 seconds, you just have to include the following javascript statement in your eSpace javascript.
osOnChangeTimerDelay = 3000;
Thanks!
Ricardo Ferreira wrote:
Hi Ricardo, sorry for my ignorance, where can I find & change the osOnChangeTimerDelay javascript variable, could you show me a screenshot? I cannot seem to find it anywhere, sorry I'm a newbie with a personal environment only. Thanks.
$('#element').bind('keyup', function() { alert('hello world!!') } );
$('element').keyup(function() { });
Any idea if a similar setting kan be used in a P10 generated application ? Setting the timer variable does not work in that setup unfortunately, it also uses a very short timeout.
Hi Andre,
It's a JavaScript variable, so it's not directly available in Service Studio. But if you start a Web App, and use your browser's devtools, you can query the variable:
If you want to change it, you'll need to write some JavaScript yourself.
Do you use console.log() for this?
Should that variable be visible in a mobile app? If I debug a mobile app in chrome and inspect with chrome dev tools, I cant see that variable. Would be good to lengthen it a bit if poss!
Hi Danny,
No, the variable is probably not available to mobile apps. But with mobile apps you have also access to onblur, which might suite you better?
I am literally working on doing that right now Kilian, thanks!!!
Hi Kilian, sorry to keep pressing for this but I am still learning the platform and I am not a developer, could you explain how to implement the javascript in espace to the suggested 3 seconds..
I have not found were I can add javascript in the espace and how ot implement this code. thanks
Hi André,
For Mobile Apps, adding JavaScript is as simple as using the JavaScript Statement:
Since they are part of the flow, they can interact with the rest of the code via Input and Output Variables. This is probabably what you want for the osOnChangeTimerDelay.
Larger scripts can be added in the Scripts Folder on the Interface tab. These are typically .js files that you want to include rather than smaller stuff written yourself. Note that there's no input/output here, so they must be self-contained. To include them in a Screen, select them in the Required Scripts Property of the Screen.
Hi @Kilian Hekhuis,Sorry for the question, this post is old but I think you can help with this.I am trying to delay the onchange on my input field in reactive. I added the script with only this: osOnChangeTimerDelay = 3000;I also tried called this script on screen, module and on initialize and I still can't make this work.Last year I tried with traditional and it worked, but with reactive I can't make it work.Can you help me please?
Hi Diogo,
Please do not reply to old topics, especially if you have a new question. I'd advise you to start a new topic, perhaps referring to this thread. Unfortunately, I can't help you here.
Hi Kilian,
Sorry, you are talking to a newbie (both OS and JS). Could you explain "baby steps" what exactly I need to do.
I have an email input field with a On Change action to validate the email address. Problem is this tries to validate the address too fast.
Here is what I have attempted to do so far (but failed):
Help?
The osOnChangeTimerDelay is a setting that (apparently, I'm going by Ricardo's information here) changes the time it takes for the Platform to fire an onchange event. So you need to set that once (per Screen, probably).
What you have attempted to do is calling the delay setting function after the onchange has fired, which of course is not what you need to do. Also, you gave the JavaScript function the same name as the variable, and I'm not very proficient in JavaScript, but I think that's not a good idea...
Try this component. It might help you.
https://www.outsystems.com/forge/component-overview/9294/input-stoptyping-event