Copy link to clipboard
Copied
Hello,
I want to create a timer that pop-ups after a specific amount of time.
The User also should be able to stop the timer and the pop-ups. (by choosing between two Radio Buttons)
My problem is: the pop-ups never stop Can anyone help me? Thanks
var timer= 0;
var Feld = this.getField("Group3").value;
if (Feld == "1")
{
function DoIt() {
app.alert("Sie müssen erst einen Wert eingeben!");}
timer = app.setInterval("DoIt()", 50000);
}
else
{
app.alert("Gestoppt");
app.clearInterval(timer);
}
Copy link to clipboard
Copied
What runs this code (eg is this a validate event for Group3)?
Copy link to clipboard
Copied
Recursively calling the same timer is not a good idea. Especially when it is an interval timer. Call the interval timer function once, and once only.
Copy link to clipboard
Copied
Also, timers are suspended when a modal dialog is displayed.
Can you explain the ultimate goal? It really isn't practical to use an interval timer to continuously display alerts
Copy link to clipboard
Copied
Hey. Thanks for the feedback.
It will be a document where the user has to enter a number every 5 minutes. Therefore I want to create a Pop-up to remind the user.
There also should be the posiibility to stop the pop-up (for example when you are in a meeting ...).
Thanks for the support!
Copy link to clipboard
Copied
You want to do something tricky. So you have to think through all the possibilities. For example, the alert box is modal, meaning it blocks anything else from happening until the user clicks on ok/cancel. So what happens if the user doesn't click on anything. What happens if the user doesn't enter a number. Is the time reset every 5 minutes, or when the user enters the number? What are all the specific actions that occur for all cases? How exactly do you want all this to happen?
A better option might be to display a fake popup. You can hide and show form fields. When done right, they look and act a lot like a modeless dialog. Then you could display dynamic data, such as the number of entries the user missed, and the amount of time that has elapsed since the last entry.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now