Creating a New Contact in Bubble.io
In this Bubble tutorial video, I'm going to show you one way that you can save data to your database from your design. We've got a form here and this is going to create a contact and if I show you my data tab, I've already got a data type called contacts. So how do I save name and email address and create a new contact?
Introduction to Planet No Code
But before I launch into that, if you're new to Bubble or even if you've been using Bubble for months, we are Planet No Code and we've got a website, planetnodecode.com where you can find Bubble tutorial videos that you cannot find on YouTube. We've got amazing tutorials exclusive to our members only available at planetnodecode.com.
Creating a Workflow to Save Data
Let's get back to this. How do we save it? So we have a button and we have two fields and I'm going to add a workflow to the button. So I click on the button and I click add workflow and that takes me into the workflow tab and it sets up a workflow for when button create is clicked. I can now do a series of actions and the action that I want to take is data create a new thing and then I choose from my data types that I've already got and this time I'm choosing contacts.
Linking Form Inputs to Database Fields
And then I find the field. So I have name and I have email and now I need to link my form, my inputs in the design tab to the fields here saying that name equals and so I find my input name. And it's value and I find my input email address and it's value.
Testing the Workflow
Let's preview that. So let's put in a name and we'll put in an email address. And I click create and hopefully if we go into data. We'll see that a new record has been created for Tony with email address Tony at Stark.com.
Conclusion and Next Steps
So that's how you do it. That's a really simple way of saving data to your database. A next step would be most people if you are taking your user to a form and you want them filling that in and then you want to take them back you would add in a go to page. And say taken back to your index page or your dashboard page so that when they've completed the form as you saw when I just did it you're stuck. You want to change that you want to move them on to your next page keep the flow going in your app.