[Fixed]-Why is a formfield's errors a list in Django?

1👍

Yes, it is possible for a field to have more than one error. For example, you can use the add_error method to add multiple errors to the same field:

class MyForm(forms.Form):
    field1 = forms.CharField()

    def clean(self):
        self.add_error('field1', 'error1')
        self.add_error('field1', 'error2')

0👍

It is possible to have multiple errors per field, you can instantiate ValidationError and add it to a particular field in the form’s clean() method via Form.add_error() here.

👤slurms

Leave a comment