We are at it again with our “DeskSculpt Inc” office rental application. Let us continue our work from the previous tutorial and build a way for our users to actually book a reservation at an office space. If for some reason you haven’t completed the previous tutorials we encourage you to do so. If however you want to start with this tutorial, no problem you can easily get the resulting application of the previous tutorial from “The Hub” by installing “NoCode-Xcelerate #3”.
In this tutorial we aim to create a reservation form for our Office rental application. This form will store a reservation in the built-in database.
Lets start by designing our form page. This page will contain all the fields we need to create a reservation and a button to submit our request.
This component is what we call a “Container” component. A component that can contain other components. The vertical list stacks components vertically and is a perfect component to create a clean form. Lets start by positioning our “Vertical list” and then add other components to it.
Lets make all fields cover 100% of the vertical list. For each component do the following:
Okay, thats a good start, now we can provide each field with a descriptive label and activate validation of our form. Form validation has been made extremely easy within NoCode-X. You might have noticed that we have a component for various types of input: “email”, “url”, “numbers”, etc… Each of these fields already have a basic set of validation rules inside them, which can be customized according to your needs. Of course good validation within an application comes in 2 forms: front-end validation and back-end validation. Validation on your form is considered “front-end” validation. Validation on the back-end can be achieved by enforcing rule on your data-format. We will cover this in detail in a later tutorial.
Firstname:
Lastname:
For each form field:
For the button:
Looks great, time to use it our application!
In tutorial #3 we have built a nice detail page for offices. On this detail page there is a button containing the text “Book this office”. Lets make our form appear when clicking this button.
A new action appears. We want this action to load our form inside a dialog. This is really easy within NoCode-X and only requires a small amount of work. Lets dive in:
There we have it, a nice dialog showing our reservation form. Now lets make it save a reservation in our built in database.
When we want to handle data within NoCode-X we should always start by defining a data-format. Lets create a data-format for our Reservation data and use this format to create reservations upon submitting our reservation form.
Don’t forget to hit “save” to completely save your Data-format.
Now that we have our “Reservation” Data-format in place, lets go ahead an make it possible to create some “Reservation” data.
These functions will fetch the value inserted in your form and put them on the “Variable scope” ready for you to use within the next steps of our logic. The only thing we need to do for each of these functions is define from which “field” component the value should be fetched & define a name under which to store the value in the “Variable scope“.
Repeat this process for each of the functions with the Following data:
Now that we have all the data we need sitting there in the “Variable scope” we can continue creating our reservation data. Lets start by creating a recognizable name for our piece of data. We will create the following “Office reservation for <EMAIL>”, which we can easily do by creating a string variable in this format:
Okay, time to write our data to the database.
The only thing left for us to do, is make sure the reservation form closes after the date has been saved and the user gets a clear success message. Both these things are very easy to pull off.
To close the reservation form we will just close the dialog. We can use the function “Hide a dialog” for this which will simply close the dialog that’s opened at the moment.
For showing a success message we can use a snackbar. We can simply use “Show a snackbar” and provide it with a message and an amount of milliseconds this snackbar should stay open.
If all worked well, you can now create a reservation by testing your application and find it within the “Data” section of the NoCode-X editor. Tip: You can easily find this piece of data by using the filters to filter the “Data-format” and the “Environment”.
Opening up this piece of data, it should look like this:
Voila another piece of functionality done within our application! Care for more action? The next tutorial is a real treat! We will learn how to integrate with third party applications, check out: NoCode-Xcelerate: Integrating an office rental application with Mailjet.
Interested in all updates to our platform? Subscribe to our newsletter.