Forms, Validation, and User Input Design
Designing usable forms
Form structure
Forms should be concise, clearly labeled, and organized in a way that matches user goals. The right input type can improve mobile keyboards, validation, and accessibility.
Labels, hints, and affordances
Every input should have a programmatically associated label. Helpful hints should be placed near fields, and placeholder text should not replace labels because it disappears and often fails as accessible guidance.
Accessibility rule
A visible label is not optional for meaningful form controls.
Validation strategy
Client-side and server-side validation
Client-side validation improves user experience by catching common mistakes early, but server-side validation is still required because client-side checks can be bypassed. Use clear, specific messages that help users fix the issue.
Why should forms be validated on the server even if client-side validation exists?
Server-side validation is necessary because client-side checks are not a security boundary.
Correct answer: Because client-side validation can be bypassed
What should every meaningful form control have for accessibility?
Labels help users understand what information is expected and support assistive technologies.
Correct answer: A label
Error messaging
Error messages should identify the field, explain the problem, and suggest how to fix it. Avoid vague warnings that force users to guess what went wrong.
Why is placeholder text not enough to identify a field?
Labels remain visible and accessible throughout the interaction.
Correct answer: Because it disappears when the user types and is not a reliable substitute for a label.