In this guide, we'll create a simple app that uses a **[Form](/docs/widgets/form)** component to add records to a database. We'll use **[ToolJet Database](/docs/tooljet-database)** as our data source.
- Create a new app and drag and drop a **[Table](/docs/widgets/table)** component on the canvas.
- Drop a **[Form](/docs/widgets/form)** next to it.
- Since we have three columns in the database, let's update the Form with one **[Text Input](/docs/widgets/text-input)** for `name` and two **[Number Inputs](/docs/widgets/text-input)** for `quantity` and `price`.
- Name the three input fields on the form as - *nameInput*, *quantityInput* and *priceInput*. Name the button as *submitButton*.
<imgstyle={{border:'0',marginBottom:'15px',borderRadius:'5px',boxShadow:'0px1px3pxrgba(0,0,0,0.2)'}}className="screenshot-full"src="/img/how-to/use-form/load-data.png"alt="Table with Data"/>
- Click on the Add button in the Query Panel, select ToolJet Database
- Select *products* as Table name, Create row as Operations
- Rename the query to *addProduct*
- Click on Add Column and add three columns - **name**, **quantity** and **price**
- Enter code below for **name**, **quantity** and **price** column keys:
```js
{{components.form.data.nameInput.value}}
{{components.form.data.quantityInput.value}}
{{components.form.data.priceInput.value}}
```
To ensure the Table component updates with new data after adding products, trigger the *getProducts* query following each *addProduct* query execution. Here's how:
- Click on **New event handler** in the *addProduct* query to add a new event.
- For the new event, leave the event as Query Success, set Run Query as the Action and choose *getProducts* as the Query.
<imgclassName="screenshot-full"src="/img/how-to/use-form/write-data-query.png"alt="Table with Data"width="100%"/>
</div>
Now if you enter the product data on the form and click on Submit. The `addProduct` query will run and the entered data will be written to the `products` table in the ToolJet Database.
In this how-to guide, we have explored a practical application of the Form component in ToolJet. You can apply the same principles for a variety of use cases that requires data input from the end-user.