mysociety / contract-countdown

https://mysociety.github.io/contract-countdown/
0 stars 0 forks source link

Add error handling to 'exact council' field of email alert form. #39

Closed alexander-griffen closed 1 year ago

alexander-griffen commented 1 year ago

Fixes #31

The best practises suggest that error handling shouldn't take place in the view, however, because this part of the form is hard-coded into the HTML rather than as part of a Form class associated with the filter, this is the only place this validation can occur without breaking the site.

Furthermore, ideally, when an error happens, the html template should announce it in a div with the class "invalid-feedback", however this doesn't render (which is a known error in bootstrap 4, but I couldn't find much either way for bootstrap 5), which is why it has been mimicked and put inside an if/else.