# Duplicate Data Entered into the database

**URL:** <https://forum.bubble.io/t/duplicate-data-entered-into-the-database/7742>\
**Category:** Database\
**Created:** [November 9, 2016, 8:48pm UTC](https://forum.bubble.io/t/duplicate-data-entered-into-the-database/7742 "2016-11-09T20:48:38Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![closej402880](https://avatars.discourse-cdn.com/v4/letter/c/57b2e6/32.png) [@closej402880](https://forum.bubble.io/u/closej402880)\
**Post date:** [November 9, 2016, 8:48pm UTC](https://forum.bubble.io/t/duplicate-data-entered-into-the-database/7742/1 "2016-11-09T20:48:38Z")

</div>

HI Guys,

Im having trouble with duplicate entries in the database. Im using the condition ‘if count is 0’ then create the thing. The problem is that if i repeatedly tap the ‘button’ that triggers the workflow the data is entered twice, seemingly in a gap between the data been added to the data base and the repeated clicks. Im thinking this maybe down to lag between the initial clicks workflow running and the data entering the database.

Any ideas of a workaround would be greatly appreciated.

Thanks,

Joe

---

<div class="post-metadata">

**Author:** ![fayewatson](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/fayewatson/32/2686_2.png) [@fayewatson](https://forum.bubble.io/u/fayewatson)\
**Post date:** [November 9, 2016, 10:50pm UTC](https://forum.bubble.io/t/duplicate-data-entered-into-the-database/7742/2 "2016-11-09T22:50:06Z")

</div>

Hey Joe 🙂 Can you share a link to the editor?

---

<div class="post-metadata">

**Author:** ![anon39705632](https://avatars.discourse-cdn.com/v4/letter/a/b38774/32.png) [@anon39705632](https://forum.bubble.io/u/anon39705632)\
**Post date:** [November 10, 2016, 8:32am UTC](https://forum.bubble.io/t/duplicate-data-entered-into-the-database/7742/3 "2016-11-10T08:32:51Z")

</div>

Disable the button on the click event and first action of the workflow.

---

<div class="post-metadata">

**Author:** ![closej402880](https://avatars.discourse-cdn.com/v4/letter/c/57b2e6/32.png) [@closej402880](https://forum.bubble.io/u/closej402880)\
**Post date:** [November 10, 2016, 11:32am UTC](https://forum.bubble.io/t/duplicate-data-entered-into-the-database/7742/4 "2016-11-10T11:32:24Z")

</div>

Hi,

How would i go about doing that?

Ive come up with a bodge for know of having an alert appear over the button.

Thanks,

Joe

---

<div class="post-metadata">

**Author:** ![fayewatson](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/fayewatson/32/2686_2.png) [@fayewatson](https://forum.bubble.io/u/fayewatson)\
**Post date:** [November 12, 2016, 3:06am UTC](https://forum.bubble.io/t/duplicate-data-entered-into-the-database/7742/5 "2016-11-12T03:06:22Z")

</div>

Here is a forum example of disabling a button on click using custom states:

Preview:

> **[Bubble - Visual Programming](https://forumapp3.bubbleapps.io/version-test/disable_button)**
>
> Build stuff without code and launch a startup without a tech-cofounder! Bubble is a visual programing language. Instead of typing code, use a visual editor to build applications.

Editor:

> **[Bubble Editor - Forumapp3](https://bubble.io/page?type=page&name=disable_button&id=forumapp3&tab=tabs-1)**
>
> Build stuff without code and launch a startup without a tech-cofounder! Bubble is a visual programing language. Instead of typing code, use a visual editor to build applications.

In this example, a new Fruit is created using the Input’s value, and the Create Button creates that new Fruit.  
 ![](https://us1.discourse-cdn.com/bubble/original/2X/7/724dfdafd294238b029d17cc8f27511304342084.png)

The workflow for the Create Button is this:

A New Thing (Fruit) is created:

 ![](https://us1.discourse-cdn.com/bubble/original/2X/8/862716992e2b3c10c3908b10d4869652a2ef6b94.jpg)

The next step is to create a new custom state on the Create Button which will not make it clickable after after it’s been clicked once. To create and set a custom state on the button, the action in the workflow is:

Element Actions → Set State → Element: Button Create, Custom State: create a new custom state…

![](https://us1.discourse-cdn.com/bubble/original/2X/d/d13dfa59b16cf6abbfec158611a32411e4bfd7ab.png)

This creates the custom state (Clickable State) on the Button. Then the value is set to “no”.

 ![](https://us1.discourse-cdn.com/bubble/original/2X/4/4499e0da0922db32f83616e99b17b21ad6f28362.jpg)

The last step is to edit the conditional formatting of the Create Button to not be ‘clickable’ when the Button’s Clickable State is “no”.

 ![](https://us1.discourse-cdn.com/bubble/original/2X/1/1ae07ad4c73fafa57ba31c34db07679484c206d3.jpg)

And that will disable it, unless the page is refreshed or if a different element action sets the Clickable State value to “yes”.

---

<div class="post-metadata">

**Author:** ![closej402880](https://avatars.discourse-cdn.com/v4/letter/c/57b2e6/32.png) [@closej402880](https://forum.bubble.io/u/closej402880)\
**Post date:** [November 21, 2016, 4:10pm UTC](https://forum.bubble.io/t/duplicate-data-entered-into-the-database/7742/6 "2016-11-21T16:10:54Z")

</div>

Sorry for the late reply. That worked 100% Thanks!!!

---

<div class="post-metadata">

**Author:** ![recrutbox](https://avatars.discourse-cdn.com/v4/letter/r/a9adbd/32.png) [@recrutbox](https://forum.bubble.io/u/recrutbox)\
**Post date:** [March 13, 2017, 9:54am UTC](https://forum.bubble.io/t/duplicate-data-entered-into-the-database/7742/7 "2017-03-13T09:54:16Z")

</div>

Hi @fayewatson 🙂 thanks for your help !!

---

<div class="post-metadata">

**Author:** ![collegefund.me](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/collegefund.me/32/11688_2.png) [@collegefund.me](https://forum.bubble.io/u/collegefund.me)\
**Post date:** [July 15, 2017, 1:44pm UTC](https://forum.bubble.io/t/duplicate-data-entered-into-the-database/7742/8 "2017-07-15T13:44:02Z")

</div>

This is awesome, thanks @fayewatson! Simple and elegant.

---

<div class="post-metadata">

**Author:** ![bajerlin](https://avatars.discourse-cdn.com/v4/letter/b/3bc359/32.png) [@bajerlin](https://forum.bubble.io/u/bajerlin)\
**Post date:** [February 20, 2018, 7:19pm UTC](https://forum.bubble.io/t/duplicate-data-entered-into-the-database/7742/9 "2018-02-20T19:19:56Z")

</div>

Hi @fayewatson, do you know if there is a way to search only for exact data entry?

Right now, if I create a data entry “Product” and then subsequently type in “Production”, “Production” won’t be saved because the word contains the word “Product” in it. 😕

---

<div class="post-metadata">

**Author:** ![gaurav](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/gaurav/32/6666_2.png) [@gaurav](https://forum.bubble.io/u/gaurav)\
**Post date:** [February 20, 2018, 7:24pm UTC](https://forum.bubble.io/t/duplicate-data-entered-into-the-database/7742/10 "2018-02-20T19:24:42Z")

</div>

It might be a good idea for bubble team to add a feature like ‘disable while workflow is running’ that you could check / uncheck on a button like other properties

---

<div class="post-metadata">

**Author:** ![fayewatson](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/fayewatson/32/2686_2.png) [@fayewatson](https://forum.bubble.io/u/fayewatson)\
**Post date:** [February 20, 2018, 9:10pm UTC](https://forum.bubble.io/t/duplicate-data-entered-into-the-database/7742/11 "2018-02-20T21:10:23Z")

</div>

@bajerlin are you using ‘contains’ or ‘=’ in the search when the button is clicked? It should be = in order for it to bring up only exact matches. 🙂

---

<div class="post-metadata">

**Author:** ![bajerlin](https://avatars.discourse-cdn.com/v4/letter/b/3bc359/32.png) [@bajerlin](https://forum.bubble.io/u/bajerlin)\
**Post date:** [February 20, 2018, 11:18pm UTC](https://forum.bubble.io/t/duplicate-data-entered-into-the-database/7742/12 "2018-02-20T23:18:33Z")

</div>

@fayewatson ahh thanks! That was a facepalm moment for me 🤦‍♂️
