Editing input fields and leaving some blank leads to data loss in database

Just started out yesterday with Bubble, and am loving it! This is most likely a rookie problem, but something I’m sure would benefit others as well to know:

I have a settings page, where the user can change their information. The fields for input are:
First name
Last name
License Plate
Vehicle name (Optional)

Those are stored under the user in Bubble’s database.

The problem is:

If the user changes only some (but not all) of the fields, the ones not changed revert to blank (null) spaces in the database. Effectively this destroys the info already in the database.

So even if the user had inputted data previously, and decides to save, for example, only their first name again, all of the data from the other fields will be saved as null when the user clicks the “save details” -button.

Currently the workflow for pressing “save details” looks like this:

How can I make it so that the database is not affected by the input fields, the user decides to leave blank?

Hi there, @tomi.dostinov… if I understand your post correctly, you will want to set the Initial content of the inputs to show what is already in the database (this is ideal from a user experience perspective, too, because you want the user to be able to see the data they have already entered). Then, when the data is saved, no data will be lost because the inputs aren’t actually blank. Make sense?

Hope this helps.



Looks like I actually had an additional issue, in that I had “Reset Inputs” in the button workflow. After deleting it, seems to be working.

One more important question about this: Is there any way to protect the database in a way, that would disable changes to a field, if it were left blank? Or is there a workaround that would achieve similiar results?

I appreciate your input on this!!

Sorry, but I don’t understand your question. Are you talking about making an input on a form a required field?

If a field in the database has data in it and you have an input on a page that is going to update that field, then the way to “protect” the field is to do what I described (set the Initial content of the input to the field’s value). I guess you could also update a field in its own workflow with an Only when condition that specifies that the related input isn’t empty, but that is not a good idea because there will almost certainly be times when there is data in a field and the user actually wants to get rid of that data by blanking out the input.

1 Like

Actually making an input a required field would indeed solve the issue. I guess clicking “This input should not be empty” would do the trick.

Thanks again for your great insights! :star_struck: :clap:

1 Like

Yup, that’s the setting. You will probably still want to set the Initial content of the input to the field’s value so users can see data they have already entered, but you probably get that point by now.

1 Like

Very true also! I hadn’t actually thought of that.

1 Like