Opened 15 years ago
Closed 12 years ago
#13421 closed Bug (worksforme)
FormWizard Documentation doesn't mention that POST params' names change
Reported by: | hendrixski | Owned by: | nobody |
---|---|---|---|
Component: | Documentation | Version: | 1.1 |
Severity: | Normal | Keywords: | FormWizard, forms, wizard, |
Cc: | Triage Stage: | Accepted | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
http://docs.djangoproject.com/en/dev/ref/contrib/formtools/form-wizard/ is a great document, just one thing it's missing (which took me some time to discover because it's non-obvious and *should* be in the documentation).
FormWizard changes the names of the POST parameters by prepending the step number before the name of the field as it appears in the original form class. For example: slug=forms.CharField in form0 will need to be <input name="0-slug"> instead of just "slug" as you would normally expect. This impacts those who wish to make their own custom forms, because their forms won't validate even though they're passing in all of the right params... or it will seem that way, because they don't know that the right params have a step-number put in front of them.
Hope that's a good description of the situation. And I really hope this saves somebody else a bunch of time.
Cheers,
Barnaby
Change History (7)
comment:1 by , 15 years ago
Triage Stage: | Unreviewed → Accepted |
---|
comment:2 by , 14 years ago
comment:3 by , 14 years ago
Severity: | → Normal |
---|---|
Type: | → Bug |
comment:6 by , 12 years ago
As this is the normal behavior of forms when using prefix, I think there is no need for extra documentation in the wizard docs.
comment:7 by , 12 years ago
Resolution: | → worksforme |
---|---|
Status: | new → closed |
I agree with steph. This is discussed implicitly in the get_form_prefix
method along with a link to the "form prefix documentation".
If you make sure you validate a form with is_valid, django.forms.BaseForm._clean_fields and django.forms.BaseForm.add_prefix will make sure you get the right data from the POST (cf. http://code.djangoproject.com/browser/django/trunk/django/forms/forms.py#L278). Is this a 'worksforme'?