Discuss the importance of form validation and how it can be achieved in HTML.
Instruction: Explain the concept of form validation and methods to implement it in HTML.
Context: This question tests the candidate's knowledge of form validation in HTML, ensuring data integrity and user feedback.
Updated
Official answer available
Read the opening below, then unlock the full answer and practical guidance.
Client-side validation gives timely feedback and helps prevent accidental mistakes. It is not a security boundary: a caller can bypass the page and send an arbitrary request. The server must independently validate types, ranges and business rules, authorize the action, and handle unsafe content appropriately.
<form action="/registration" method="post"> <label for="email">Email address</label> <input id="email" name="email" type="email" required> <label for="seats">Seats, from 1 to...