I have a set of pretty complex forms that I’d like to implement in django. Several of the later fields depend on the values in the earlier fields, and the validation rules are very complicated.
For example, suppose the form is helping users file state tax returns. On the first page, I might have a select box where users choose a state (Alabama, Arkansas, Alaska…). Depending on which state gets chosen, the next page will ask completely different questions, since taxes are so different across states.
This seems like the kind of thing that form wizards ought to be good at, but I’ve never done a django wizard before, and I have some worries.
First, do form wizards work with AJAX? Specifically, I’d like to load and render the form (and all its steps) within in a jquery tabs object. As each step is completed, the next page of the form would be dynamically loaded, without reloading the whole page.
Second, AFAICS, conditional view/skip patterns in django’s form wizard only do booleans. One key part of my form flow is the long-ish select input: choosing the state. Form wizards don’t look like they can handle that kind of pattern very gracefully. Is there a good workaround or alternative?
On the whole, are form wizards the right way to implement this kind of structure? Using jquery alone seems unhandy, since I’d (presumably) have to load all 50 state-specific forms together at the beginning.
In the end, the answers to my questions were “No,” and “No.” Standard formWizards just don’t do AJAX and complex conditionals gracefully, so I ended up writing my own set of classes to do it.