chapter eight

8 Working with templates for tutor registration

 

This chapter covers

  • Designing tutor registration feature
  • Setting up the project structure
  • Displaying the registration form
  • Handling registration submission

In the previous chapter, we covered the basics of working with Actix to develop a server-side web application. In this chapter we’ll learn more details of how to work with templates, by creating a tutor registration form using Actix and Terra.

Templates and forms are an important feature of web applications. They are used quite commonly for registration, sign in, capturing user profile, payment information or KYC (know-your-customer) details for regulatory purposes and performing CRUD (create-read-update-delete) operations on data. While capturing user inputs, it is also necessary to validate them and provide feedback to the user in case of errors. In cases where the forms involve data updates, existing information has to be presented to the user in the form, allowing the user to change it. There are also elements of styling to be added for aesthetic appeal. On submission of forms, the form data needs to be serialized into an HTTP request which should then invoke the right handler functions for processing and storing the form data. Finally, the user needs to be given feedback on the success of the form submission, and then optionally taken to the next screen. We’ll learn how to do all these in this chapter using Actix Web, Tera template engine and a few other components.

8.1 Designing tutor registration feature

8.2 Setting up the project structure

8.3 Displaying the registration form

8.4 Handling registration submission

8.5 Summary