abstra-docs
Search…
Basic form
Creating a form page and storing data on the interface

Creating a basic form

In the Backend tab. Create the table where the data will be stored.
Add a complete flag where you know if there this form was sent
Adding the product table
Adding some mock data for the products table
Create the product list query
In the Frontend tab, create a variable to store the form data
Add the inputs
Link each input to the variable

Creating the order -> product relashionship

Add the relationship column
Create a variable to store the options
Get the list of products on page start
Link this list to the dropdown maping the list of product to the options structure
Code of mapping:
1
$.products.map(p => ({value: p.id, label: p.name}))
Copied!
To check if is everything alright, test it in the preview mode
Create the query to insert the data in the database
Code of query:
1
insert into "order"
2
(email, amount, product_id)
3
select
4
email, amount, product_id
5
from json_populate_record(null::"order", $1)
Copied!
To fininish, let's add the button action
Last modified 5mo ago