Velo Tutorial: Creating a Form to Store User Input in a Database Collection

6 min read
Visit the Velo Documentation Center to onboard and continue learning.
In this tutorial, you’ll learn how to build a custom form to capture user input. We’ll show you how to lay out a form with User Input elements, create a database collection and connect it to these elements using a dataset. Finally, we’ll test the form in Preview mode and publish the site so that users can submit content. 

1. Enable Velo

Velo adds advanced functionality to the Wix Editor, allowing you to create a more interactive and dynamic site.
To enable Velo:
On the Editor Top Bar, click Velo, and then click Enable Velo.
Once you’ve done this, you’ll notice a few changes in the Editor:
  • The Properties panel appears. If you close it, you can open it again from the Tools menu.
  • The code panel is added to the bottom of the Editor.
  • The Site Structure sidebar is added to the left of the Editor.
  • More elements are available in the Add menu, including Database and User Input.

2. Create a Database Collection

A database collection is where you store the content you need for your site, or where you collect information submitted by your users. When you create a collection, you also need to define its permissions. These let you control what your users can do with the data in your collection. Here, we’re adding an empty collection that will store content that users submit through a form. ​

To create a collection:
  1. In the Site Structure sidebar, click the + icon next to Database and select New Collection. If the Introducing Database Collections screen pops up, click Start Creating.
  2. In the Create a Database Collection screen, give your collection a name.
  3. From the dropdown, select the intended use for your collection. Consider which users you want to be able to read, write, modify, or delete your data. For your form, you would probably choose Form Submission, allowing anyone to submit content, but giving only you (the Admin) permission to read, modify, and delete its content. 
  4. Click Create Collection.
    Your new collection opens in the Data Manager, which is a spreadsheet-style table that lets you manage the content in your database collection.

3. Set Up Your Database Collection

Let’s assume that your site is offering a promotional giveaway, and you want visitors to be able to sign up for it by submitting their information. In this case, you need to add a field for each piece of information you want your users to submit.

To set up a collection:
  1. In the Data Manager on the right of the header row, click the + to add a field to your collection. 
  2. Set up the field to match the information you want users to submit. Make sure to select the correct field type to match your field’s content.
  3. Create a field for each of your planned form elements. 

4. Design Your Form

Your form must include elements that allow users to enter the information you want to collect. To set this up, you need to use User Input elements, which are available in the Add menu.

To get started:
  1. Go to the Add menu and select User Input.
  2. Drag elements from User Input onto your page to design and lay out your form. You can select from elements like Input, Radio Buttons, Dropdown Lists, and Upload Buttons.

5. Set Up Your Elements

Once you add User Input elements, you’ll need to configure each element in its Settings panel.​ Settings include things like the type of the input, its placeholder text, its initial value, if the element is a required field, and if the element is read-only.

​To set up your elements:
  1. Select a User Input element, click the Settings icon, and use the Options to configure it.
  2. Repeat this for each of the User Input elements in your form.​

Now you’ll need to connect your User Input elements to your collection. We'll use a dataset to do that, which we’ll cover in the next few steps.

6. Add and Configure a Dataset

A dataset connects your elements to your collection. When you add a dataset, you'll need to decide which collection you want to connect to, whether you want your users to be able to read and/or write to your collection, and more. ​

To add a dataset to your page:
  1. On the Add menu, click Database, and then Form Dataset
  2. Select the dataset that was added to your page, and click Manage Dataset
  3. In the Dataset Settings panel, under Connect a Collection, select your collection.
  4. Close the panel.

7. Connect Your Form Elements

Once you have your dataset configured, you can connect your elements to it. You need to go to each of the elements in your form and connect it to the same dataset. Each time you connect an element, you also define which field in your collection its value should connect to.

To connect your User Input elements:
  1. Select an element and click its Connect to Data button.
  2. In the Connect panel, select the field in your collection where the user-entered information should be saved.
  3. Repeat this for each of the User Input elements in your form.

In the next step, we'll create a Submit button. The same dataset will handle saving the content that the user entered into the collection.

8. Create a Submit Button

Now that all your elements are connected to the same collection through the same dataset, you need to allow users to submit their information. To do this, add a button to your page, connect it to the same dataset as the other elements, and define its click action.

To create a Submit button:
  1. Add a button to your page and change its text to Submit.
  2. Click the Connect to Data button.
  3. In the Connect Button panel, under Link connects to, select Submit.
  4. Optionally, create a Submit Message (step 5).
  5. Under When successful, navigate to, the default is Stay on this page. You can also choose A link... to send users to another page after submission is complete.

When users submit data, it will be validated before it is saved.

9. Test Your Form

Now you can test your form in Preview mode. The content you submit will be saved to your Sandbox Database, which is used only in the Wix Editor and is visible only in Preview mode. 

To test your form:
  1. Click Preview.
  2. Fill in the fields and click the Submit button.
  3. Go back to the Editor and then check your collection to see the new item that was created.

10. Publish Your Site

Now it’s time to publish your site so that users can submit their content. ​

Publishing your site creates an empty version of your collection with all the fields from your Sandbox Database. The content your users submit is saved to your Live Database, which you can access from your dashboard.

​In the Editor, click Publish to publish your site.

11. View Your Live Data

When you publish your site, your form will be available to your site visitors. When a user submits a form in the published site, the form data will be saved to your Live Database.

To view user-submitted information:
  1. Click Settings from the top bar, and then click My Dashboard
  2. On the Sidebar Menu, click Database.
  3. Click the collection to view your live data.
You can sort and filter your data here. For example, you can display the Date Created system field and then sort by it so you can see the latest submissions.

Next Steps

With Velo you can add more functionality to your form:

Did this help?