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

**URL:** <https://forum.bubble.io/t/editing-input-fields-and-leaving-some-blank-leads-to-data-loss-in-database/221360>\
**Category:** Database\
**Created:** [August 24, 2022, 12:52pm UTC](https://forum.bubble.io/t/editing-input-fields-and-leaving-some-blank-leads-to-data-loss-in-database/221360 "2022-08-24T12:52:46Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![tomi.dostinov](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/tomi.dostinov/32/144182_2.png) [@tomi.dostinov](https://forum.bubble.io/u/tomi.dostinov)\
**Post date:** [August 24, 2022, 12:52pm UTC](https://forum.bubble.io/t/editing-input-fields-and-leaving-some-blank-leads-to-data-loss-in-database/221360/1 "2022-08-24T12:52:46Z")

</div>

Hi,  
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)

 ![Screenshot 2022-08-24 at 15.46.35](https://us1.discourse-cdn.com/bubble/original/3X/5/b/5b7adff4fc14ae74f77551366ef37292592c0bfe.png)

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

 ![Screenshot 2022-08-24 at 15.45.51](https://us1.discourse-cdn.com/bubble/original/3X/0/1/018341e34a4666e39bc26bfaad327333af704350.png)

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:

 ![Screenshot 2022-08-24 at 15.42.18](https://us1.discourse-cdn.com/bubble/original/3X/8/9/89f6529fb1b158a5749a9128112d558bc83c2fbf.png)

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

---

<div class="post-metadata">

**Author:** ![mikeloc](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/mikeloc/32/93001_2.png) [@mikeloc](https://forum.bubble.io/u/mikeloc)\
**Post date:** [August 24, 2022, 12:55pm UTC](https://forum.bubble.io/t/editing-input-fields-and-leaving-some-blank-leads-to-data-loss-in-database/221360/2 "2022-08-24T12:55:53Z")

</div>

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.

Best…  
Mike

---

<div class="post-metadata">

**Author:** ![tomi.dostinov](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/tomi.dostinov/32/144182_2.png) [@tomi.dostinov](https://forum.bubble.io/u/tomi.dostinov)\
**Post date:** [August 24, 2022, 1:28pm UTC](https://forum.bubble.io/t/editing-input-fields-and-leaving-some-blank-leads-to-data-loss-in-database/221360/3 "2022-08-24T13:28:47Z")

</div>

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!!

---

<div class="post-metadata">

**Author:** ![mikeloc](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/mikeloc/32/93001_2.png) [@mikeloc](https://forum.bubble.io/u/mikeloc)\
**Post date:** [August 24, 2022, 1:33pm UTC](https://forum.bubble.io/t/editing-input-fields-and-leaving-some-blank-leads-to-data-loss-in-database/221360/4 "2022-08-24T13:33:56Z")

</div>

> [@tomi.dostinov](#):
>
> 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?

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.

---

<div class="post-metadata">

**Author:** ![tomi.dostinov](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/tomi.dostinov/32/144182_2.png) [@tomi.dostinov](https://forum.bubble.io/u/tomi.dostinov)\
**Post date:** [August 24, 2022, 1:50pm UTC](https://forum.bubble.io/t/editing-input-fields-and-leaving-some-blank-leads-to-data-loss-in-database/221360/5 "2022-08-24T13:50:42Z")

</div>

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! 🤩 👏

---

<div class="post-metadata">

**Author:** ![mikeloc](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/mikeloc/32/93001_2.png) [@mikeloc](https://forum.bubble.io/u/mikeloc)\
**Post date:** [August 24, 2022, 1:51pm UTC](https://forum.bubble.io/t/editing-input-fields-and-leaving-some-blank-leads-to-data-loss-in-database/221360/6 "2022-08-24T13:51:21Z")

</div>

> [@tomi.dostinov](#):
>
> I guess clicking “This input should not be empty” would do the trick.

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.

---

<div class="post-metadata">

**Author:** ![tomi.dostinov](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/tomi.dostinov/32/144182_2.png) [@tomi.dostinov](https://forum.bubble.io/u/tomi.dostinov)\
**Post date:** [August 24, 2022, 1:52pm UTC](https://forum.bubble.io/t/editing-input-fields-and-leaving-some-blank-leads-to-data-loss-in-database/221360/7 "2022-08-24T13:52:31Z")

</div>

> [@mikeloc](#):
>
> 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.

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