Session countdown timer - Forum

Forum Navigation
You need to log in to create posts and topics.

Session countdown timer

Hi..

I want to add a clock to my platform that countdown 10:00 minutes and if the user did not press a button that renews time, hes session will terminated and be log of.

Any ideas ?

Thanks

@smartmedia this answer has been created using VisualNEO Web GPT:

You can definitely implement a 10-minute countdown timer in VisualNEO Web, and log the user out if they don’t press a button to extend the session. Here’s how to approach this using VisualNEO Web tools and scripting:


🕒 Step-by-Step Guide: Auto Logout After 10 Minutes of Inactivity

1. Add a Timer Object

  • Go to the Tool Palette and add a Timer object to your page.

  • Set its Interval to 60000 (this means it triggers every 1 minute).

  • Give it an ID like SessionTimer.

2. Create a Countdown Variable

  • Use a variable to keep track of the time remaining, for example:

    SetVar [timeLeft] 10

3. On Timer Tick (Every Minute)

Assign this script to the Timer’s ontimer event:

SetVar [timeLeft] [timeLeft-1]
If [timeLeft] <= 0
   ... here perform your logout actions...
   AlertBox "Session Ended" "You were inactive for 10 minutes." ""
   GoToPage "LoginPage"
   StopTimer "SessionTimer"
EndIf

 

4. "Renew Session" Button

Add a Push Button labeled "I'm Here" or similar. Assign this to its onclick event:

SetVar [timeLeft] 10

This resets the countdown to 10 minutes.

5. Start the Timer

On your app’s load or on page enter:

SetVar [timeLeft] 10
StartTimer "SessionTimer"

 


This setup gives the user a visual timer (if you wish to show it), and silently tracks inactivity based on whether they press the "I'm Here" button.
After 10 minutes with no button press, they’re logged out.

smartmedia has reacted to this post.
smartmedia

Hi @luishp

Thanks for your idea.. I came up with this.  It shows also the time countdown. Thanks

 

Uploaded files:
  • You need to login to have access to uploads.
luishp has reacted to this post.
luishp

Hi..

I updated the code and now shows both zeros in minutes and seconds using dummy variables and all calculations made correctly.

Also, i have a question, how i will know if a Timer is running ? there is any command to run so i can examine it ? Now i am using a variable i set as an index that tells me that Timer is running.

Uploaded files:
  • You need to login to have access to uploads.
luishp has reacted to this post.
luishp