Is there a timer feature?

Is it possible to have a timer feature in Bubble? I’m quite new with no coding background, so simple explanations are appreciated. Ideally it would be a running timer for a page and then tell you how long you took on that page, like a stopwatch. 3 phases of green, yellow and red would also be good if possible. Do I need to get someone to build a plug-in for this, or does something like this already exist?

It’s straightforward to create that in bubble. Search the forum for examples. Several explanations for how to create similar.

Best of luck!

Hey!

Bubble has an option to get the Current Time. From there you would be able to calculate things like “how long did user X spent time on page Y” or “how many days until christmas”.

Bubble also has the option to ‘Do this every X seconds’, so you can update things on your page every few seconds.

Combining these features should enable you to come pretty close to what you’re looking for, I think.

As a VERY quick example, I created this app, which counts the seconds to a specific date, and refreshes the page every 5 seconds: https://bubble.io/page?type=page&name=countdown&id=forum4&tab=tabs-1 Maybe this could give you a basic idea of how this could work.

1 Like

There are a couple of ways to do it without refreshing the page…

Use the “Do every x seconds” to set a custom state, then format the result on the page.

https://buildingonbubble.com/block/formatted-countdown-1471178176900x842421891177381900

Or you can stick a block of html/javascript on the page to do the same thing (but it doesn’t need bubble to refresh it).

1 Like

Does the “Do every x seconds” strategy consume a workflow? Could get expensive (17K+ WFs a day if 5 sec interval).

No, as it doesn’t touch the database in this case. At least not if you use a custom state, refreshing the page every 5 seconds might.

Hi Nigel,

Great advice! I’ve successfully set up a timer using custom states. I have a couple of hidden inputs (minutes and hours) with custom states called ‘number’ that increment and then text that draws its value from the two inputs number’s. It works a treat.

However, the issue I’m encountering is that I would like single digit numbers (seconds/hours) to appear as 01, 02, 03 etc. rather than just 1, 2, 3. I can’t set the value of a number to 00, only 0. Is there any trick to this? Cheers!

1 Like

Yes, if you have the seconds component as an integer, you can hide it and have another field as a text, then have a conditional on that text.

3 Likes

This topic was automatically closed after 70 days. New replies are no longer allowed.