We've already coded the view that handles survey submission to re-display the page with errors instead of processing the results, if any errors are found in the submitted forms. On the display side, since we are using the
as_p convenience method for displaying the form, it will take care of displaying any errors in the forms. So, we should have no code or template changes to make in order to see what happens when an invalid survey is submitted.
What would make a survey submission invalid? The only likely error case for our
QuestionVoteForm is if no answer is chosen. What happens, then, if we attempt to submit a survey with missing answers? If we try it, we see that the result is not ideal:
There are at least two ...