HTML Advanced Forms Interview
Advanced form interview Q&A on validation, constraints, accessibility states, and robust UX patterns.
1What is constraint validation API?medium
Answer: Browser API that exposes field validity state and methods like
checkValidity().2How does
pattern work?mediumAnswer: It applies regex validation to input values before submission.
3Use of
min, max, step?mediumAnswer: They constrain numeric/date-type input ranges and increments.
4What does
novalidate do?mediumAnswer: Disables built-in browser validation on form submit.
5How to show accessible error messages?medium
Answer: Display clear inline errors linked to fields; use semantic text and ARIA where needed.
6Difference between disabled and readonly?medium
Answer: Disabled fields are not focusable/submitted; readonly fields are focusable/submitted but not editable.
7How to handle file uploads?medium
Answer: Use input type file and set form
enctype="multipart/form-data".8When to use
autocomplete?mediumAnswer: Enable for faster UX when appropriate; disable for sensitive/one-time fields.
9How to support multi-step forms safely?medium
Answer: Validate each step, preserve state, and revalidate on final submit server-side.
10Interview best-practice summary?medium
Answer: Blend native HTML constraints, accessible feedback, and secure backend validation.
Tricky Q&A (10 Questions)
11Which input type shows a color picker?tricky
Answer: Correct answer: color. type='color' provides a native color picker.
12datalist differs from select because:tricky
Answer: Correct answer: It allows free text plus suggestions. datalist suggests values but input remains editable.
13fieldset disabled attribute effect:tricky
Answer: Correct answer: Disables all nested controls. disabled on fieldset disables descendant controls.
14Which type shows numeric steppers in many browsers?tricky
Answer: Correct answer: number. number inputs support min/max/step.
15accept attribute on file input:tricky
Answer: Correct answer: Filters allowed MIME types/extensions. accept hints which file types may be chosen.
16novalidate on form:tricky
Answer: Correct answer: Skips built-in browser validation. novalidate turns off native constraint validation.
17Which stores data only for the browser session?tricky
Answer: Correct answer: sessionStorage. sessionStorage clears when the tab closes.
18meter vs progress:tricky
Answer: Correct answer: meter is scalar gauge; progress is task completion. Use meter for known ranges; progress for ongoing tasks.
19Which validates with regex pattern?tricky
Answer: Correct answer: pattern. pattern accepts a regular expression string.
20Multiple file selection uses:tricky
Answer: Correct answer: <input type='file' multiple>. multiple allows selecting more than one file.