Opened 7 years ago

Closed 4 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 Changed 7 years ago by Russell Keith-Magee

Triage Stage: UnreviewedAccepted

comment:2 Changed 6 years ago by Staś Małolepszy

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 Changed 6 years ago by Julien Phalip

Severity: Normal
Type: Bug

comment:4 Changed 5 years ago by Aymeric Augustin

UI/UX: unset

Change UI/UX from NULL to False.

comment:5 Changed 5 years ago by Aymeric Augustin

Easy pickings: unset

Change Easy pickings from NULL to False.

comment:6 Changed 4 years ago by steph

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 Changed 4 years ago by Tim Graham

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