From the course: Building Full-Stack Applications with HTMX
Unlock this course with a free trial
Join today to access over 25,300 courses taught by industry experts.
Adding validation - HTMX Tutorial
From the course: Building Full-Stack Applications with HTMX
Adding validation
- [Instructor] In this video, we'll be improving our forms by adding validation for the information entered by the user. This will allow us to give feedback to the user for any information that might have been entered incorrectly. So back in our forms, the JS file, we'll be refactoring some of our vendor functions to take into account errors and display the appropriate messages for the errors returned when processing the form submission. We'll be doing this on our first two render functions. These are the functions that contain form input that can be entered incorrectly. The notifications and preferences section does not require this as the assumed defaults already. Our task is to take errors identified by the submission process and display them above the form. We will also ensure that the values that the user filled stays in the form, even though the submission process raised errors. Got it? Let's get started. Now before we begin, I notice that for my buttons in the form sections, I…