Run popup until data

How would I have a popup open until the user loads data into the popup/database?

I need the user to enter the odometer reading when they fill up their car. So, its not just the first time run.

Hey Benjamin! Do you want the popup to be opened when a user saves some data to the DB?

No open until a user enters data. So like until they enter the first reading of the odometer, after that its no longer needed.

@benjamin.bm.andrews how would you know the user filed up his car?

Got it! Also, are you saving the data to the DB via the input(s) in the popup or someplace else?

Assuming that the user proactively wants to enter the odometer reading after filling up the car.

  1. You can check the property for a popup to not close on ‘esc’
  2. Make sure the odometer input is mandatory
  3. Submit button workflow show save the odometer entry and hide the popup.

@benjamin.bm.andrews Let me know if I understood your use case correctly.

Yeah via popup inputs

Okay. In that case, after entering the data in the popup, and the user clicks the Save Button, you save the entry to your database. In the same workflow, you can add a workflow action as the last step, called Hide an element with the element being the popup.

Ensure that the user is not allowed to close the popup by clicking elsewhere by using Esc (more info here) - Containers | Bubble Docs

Hope this helps :slight_smile:

I get that but how do I stop the pop up running the next time they open the page. Sorry, its on page open and the app is monitoring odometer readings, how much fuel purchased and price. Works out median kms driven, ltrs consumed and cost.

Got it, no problem. I’m assuming that in your DB, you have one table (let’s call it Fuel In) that stores the Fuel records. Whenever the user fills out their fuel, they create a new entry for this in the DB.

Now I also assume that there’s another table in your DB (let’s call it Odometer Reading) that stores the odometer, KMs, etc different info in a record.

You can create a link between the 2 tables (preferably a field for the Odometer Reading in the Fuel In table). Whenever the user enters their odometer readings etc, you Create a new thing in the DB and Make changes to the latest Fuel In table.

On page load, you check for Fuel In tables where the Fuel In’s Odometer Reading is empty. If it is, show the popup. If there aren’t any results like this, don’t show the popup.

Let me know if this makes sense

P.S - I’m assuming that Odometer Reading is a different table since you would want to store additional info in that table (Reading, created time etc)

How do I do the check, thats the part I cant get my head around.

Its one table. Its only 7 pieces of info and all tied together so no need for a second table.

If it’s one table then it should be fine.

In your Do a search for, you can put a filter to check if the Odometer reading is empty or not.

On the page load, since you have the Show an element action, put a condition on that - Do a search for Records where the Odometer reading is empty. If you get a result, show the popup; if no such results are there, it won’t show the popup

1 Like

Cheers man, as soon as I started doing it, I knew exactly what I was doing, made complete sense.

Awesome! Glad you got it figured out :smile:

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