How to create a responsive order form and customer database
Online database and CRM-system builder QuintaDB helps small businesses to create order forms, including a customer database. This article will show you how to create a pizza order form.
This template can be used as basis to create your own projects.
First, we will create the "Menu" table, using following field types:
1) "Pizza" - Single Line field.
2) "Composition" - Multiple Line field.
3) "Photo" (for pizza preview) - Image field.
4) "Price" - Number field
We filled out the form and received a table with data:
The next form is "Orders". We use the following fields:
1) "Pizza" - Relationship field, linked with the "Menu" table, the "Pizza" field.
2) "Composition" and "Image" - Linked column fields from the "Menu" table, "Composition" and "Image" fields.
3) "Size" - Radio button field with two values: "Medium" and "Large".
4) "Pizza cost" - Formula field.
The Linked columns and the Formula fields are displayed on the form using the "Make the field visible in the Form" option.
We have the "Menu" table, with the price column.
Also, in the "Orders" form, you can choose between "Medium" and "Large" pizza. The total price will vary depending the size.
To avoid creating both columns for prices, we will use a "Function" tool for the Formula field.
You can read more about Functions in this article.
To calculate the cost, need to perform the following actions:
1. Create a Formula field. Select the "Function" option.
2. Select the "Script (Ruby)".
3. Write the code.
In this case, we have the following code:
if 'size' == 'Large - 14″'
if 'size' == 'Large - 14″' - - If "Large 45 cm" is selected in the "Size" field
(price*1.25).round - - Then multiply the pizza price by 1.25 (the price increases by 25%). Additionally, round the value.
else - - In other cases.
price - - Leave the pizza price.
end - - End of script
As you can see, HTML field names are used for calculations.
To copy the field name, you need to click on the "How to insert record data" link. For convenience, you can rename them, to make the code easier to read.
We have created a simple relational database. Now let's move on to the order form.
Create a new form: "Order Form".
We'll split the form into two blocks and make it multi-page.
On the first page, the user will be able to choose a pizza. On the second - contact information.
We create the following fields:
1. "Order number" - Autoincrement field. This field is not displayed on the form and will automatically assign a number to the order in the table.
2. "Your order" - Section field. Used for visual design.
3. "Select pizza" - Subform field, form "Orders" table.
4. Page break.
Edit the "Choose pizza" subform:
1. Set the minimum number of entries- 1.
2. The default number of entries is 1.
In the "Subform Settings" tab:
3. Set the "Table" data view.
4. Hide extra columns. We leave only "Pizza", "Size" and "Cost".
5. For the "Add New" link, change the text to: "Add another pizza".
Second page, contact information:
1. "Contacts" - Section field.
2. "Name", "Surname" - Single line field. (You can make it required).
3. "Phone number" - Phone field with custom input mask.
4. "Email" - Email field.
5. "Address" - Section field.
6. "Street name", "Street number", "Apartment/Suite" - Single line fields.
7. "Total" - Linked column from the "Orders" table. Used in this case to add up the values in the Pizza Cost column.
8. "Comment to the order" - Multiple Line field.
9. "Confirmation checkbox" - the user must consent to the processing of his data. The form will not be submitted without confirmation.
The order form is ready!
Go to the "Form Widget" menu. Here you can edit the design and some widget's functions.
Read more about widget's design by this link.
Entering contact information:
Table with orders:
Remember that you can change the column's name order in the table at any time, as well as hide columns in the Columns menu.
You can use this project template as a basis for the projects.
To do this, just open the Create a project page, select the "Order pizza" template and click on the "Use project" button.