Opened 14 years ago

Closed 11 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 Russell Keith-Magee, 14 years ago

Triage Stage: UnreviewedAccepted

comment:2 by Staś Małolepszy, 13 years ago

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'?

comment:3 by Julien Phalip, 13 years ago

Severity: Normal
Type: Bug

comment:4 by Aymeric Augustin, 12 years ago

UI/UX: unset

Change UI/UX from NULL to False.

comment:5 by Aymeric Augustin, 12 years ago

Easy pickings: unset

Change Easy pickings from NULL to False.

comment:6 by steph, 11 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 Tim Graham, 11 years ago

Resolution: worksforme
Status: newclosed

I agree with steph. This is discussed implicitly in the get_form_prefix method along with a link to the "form prefix documentation".

Note: See TracTickets for help on using tickets.
Back to Top