Forum Documentation Showcase Pricing Learn more

Query a list of coupon codes


#1

I’d like to save several sets of 5 digit coupon codes into my Bubble app’s database.

Type = Coupon
Field = Coupon code (number)

A page on my site would have an input field (integer) and a submit button.

The workflow of the submit button would navigate the user to another page on the site only if the coupon code entered by that user matches one of the several 5 digit coupon codes that I had saved into the database.

Is this doable in Bubble and, if so, what might that submit button’s workflow look like?


#2

Yes, you could have two workflows for you Submit button, one that only fires when the coupon matches.


#3

Two workflows makes sense.

I’m getting stuck on the workflow that would query the database for the coupon codes. What action do I use to query for a matching coupon code? I’m assuming one of the actions under the “data (things)” section, but none of them seem like the obvious choice. Create, make changes, delete, copy…none of those seem right.


#4

Ah…I see. Bubble has a Search element. :slightly_smiling:


#5

Yes :slightly_smiling:

You could look at doing a Search and then a …contains on the Action.


#6

The AutoComplete dropdown functionality is kind of getting in my way.

I don’t want it to auto-suggest anything unless there is a complete match. So if the coupon code is ABC123, then the user would have to type in the full ABC123 before getting an auto suggestion to select.

I set up an equals to constraint under the “modify list” options, but it’s not producing the desired result. It’s still auto-suggesting after two characters are typed in by the user.

Another option I’d be fine with here is turning off auto-suggestion, but I don’t see an option for that.

I built out a sample page in the forum app here… https://bubble.is/page?type=page&name=voucher&id=forum_app&tab=tabs-1

Type: Voucher
Field: Voucher Code

I entered two sample Voucher Code entries into the database as something to search against… ABC123 and XYZ789


#7

I have added another way of doing it, so a condition on the input (not autocomplete). The button isn’t clickable until you enter a valid voucher.


#8

Very cool Nigel. Thank you.

Right now it seems to be case sensitive. If I type in ABC123 the button becomes clickable, but if I type in abc123 the button does not become clickable. Is there a way to set it so that it’s not case sensitive?


#9

It is bit hacky, but I have amended so that it searches for both upper case and lower case matches.


#10

Thanks @NigelG! That did the trick. :slightly_smiling:

Is this kind of work around necessary because Bubble’s search functionality is always case sensitive by default?


#11

Ah, well, no, it seems :slightly_smiling:

The search that we did on the “send data” didn’t need this. But the condition does. Which is odd !

Maybe one to ask @emmanuel ? Case matching is different across a condition and a workflow action.


#12

Yes, right now our search is case sensitive. We might revisit that at some point but it’ll likely be a different search constraint.


#13

Hey avail the great deals and promo codes at promo code office. Here they are offering the list of coupon codes very clearly, that has been going long since for more than 3 months. Come lets grab the amazings deals at Microsoft.

Microsoft Office 365 Home Promo Codes


#14

@emmanuel do you know of any workarounds for case sensitivity in the search? When I am searching for someone’s first name it would be very helpful (i.e. “john” and “John” return the same results).


#15

@supernaturally, @pnodseth found a great workaround for that:


#16

We’ll see what we can do when we’ll be done with our backend migration. But we can’t commit on a timeline yet unfortunately.


#17

Is there a fix now?