Validation checks input, application state, or generated suggestions against expected rules and constraints. It prevents vague assumptions, unchecked submissions, and unreviewed code from becoming accepted results. section 3.9 section 7.1
Use validation as a practical workflow:
- Define the expected task, context, functionality, and constraints before judging a result. section 3.9 section 7.1
- Check submitted values, including cases where a user sends a form without selecting an answer. section 7.1.1
- Test database retrieval, answer storage, navigation, and completion behavior instead of trusting a plausible implementation. section 7.1.1
- Compare multiple AI responses, reject overengineered suggestions, and apply technical judgment to the final design. section 3.9 section 7.1.1
Validating a quiz submission
A Flask quiz displays one question with radio-button answers. The answer route receives the selected value and question identifier, stores the response, retrieves the next question, and finishes when none remains. Validation adds a check for an unselected answer and error handling for database or retrieval failures. The implementation still needs testing to confirm that questions, responses, redirects, and completion behave as intended. section 7.1 section 7.1.1
<!-- templates/question.html -->
<html>
<head>
<title>Quiz Question</title>
</head>
<body>
<form action="/answer" method="post">
<h2>{{ question.question_text }}</h2>
{% for option in question.options %}
<input type="radio" name="answer"
value="{{ loop.index }}">{{ option }}<br>
{% endfor %}
<input type="submit" value="Submit">
</form>
</body>
</html>
Inspect the Jinja form to see where user input enters the application and where answer-selection checks belong. section 7.1.1





























