jazzband / django-formtools

A set of high-level abstractions for Django forms
https://django-formtools.readthedocs.io
BSD 3-Clause "New" or "Revised" License
814 stars 136 forks source link

Allow hooking invalid form submission for a WizardView step #157

Open KyeRussell opened 4 years ago

KyeRussell commented 4 years ago

Looking here:

https://github.com/jazzband/django-formtools/blob/master/formtools/wizard/views.py#L294

It appears that there is no way for me to do anything when a step's form submission fails, without overriding all of post() to put an else: on the if form.is_valid() conditional.

Firstly, am I right in this assertion?

If so, it'd be beneficial for me personally to have this ability. I don't want to intercept and provide a new response, I just need to do some background logging.

frague59 commented 4 years ago

Hi,

I've the same issue, it should be very interesting to add this hook for step validations : I've some ModelForm + ModelFormset (having the ModelForm as FK of the ModelFormset) that could benefit of it. For now, I validate the formset with client-side JS, which is not perfect, because I do not want to hack the post() method...

KyeRussell commented 4 years ago

My particular issue was sidestepped by messing with some form code. It is not ideal in my case, and can foresee circumstances in which I'd still want my original request.

TTorture commented 1 year ago

I might have a similar issue: I have two steps using a ModelForm and a ModelFormset.. One of these forms does not validate and I am lacking a proper way to log or debug.