We need to code a 5-step form wizard. The first step should let you select products with various options, validate them, then add those items to a basket, then proceed when you are ready. The next few steps are straightforward - personal details, delivery details, payment.
The FormWizard in 1.3 makes all the later steps very easy, but we're fighting it on step 1. Has anyone done anything like this? In more detail, Step 1 should have buttons on it for "add current item to basket" (which has to validate a couple of fields with standard error messages behaviour), "proceed to checkout", plus a 'delete' button for each element in the basket. The problem is that FormWizard by default moves you to the next step when validation on Form 1 succeeds. Ideally I'd want to validate the new item and then redisplay the current page, or (if they hit a Delete button) amend the hidden variables storing the basket and redisplay the same page. I'm looking at two options 1. Write a form-level clean() method which will proceed if the user hit 'checkout' (i.e. if there is a key-value pair on the request matching that button's name/value), and will fail if they hit 'add to basket', but in the process of failing will create some extra numeric- prefixed hidden fields to store the new basket item, then redisplay the form. In this case the Wizard code will not need touching. 2. Overriding the __call__ method of the 1.3 FormWizard, which contains the following, to not always jump forward a step, but instead maybe see if the form has a 'next_step' or 'finished' attribute. Then our Form for the first page could indicate that it is not ready to move forwards yet. if form.is_valid(): self.process_step(request, form, current_step) next_step = current_step + 1 3. Any other ideas? FormWizard is very nice in our case as it adds some very useful security and validation features. I'm hoping someone will tell me there is an easy way around this! Thanks, Andy -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.