Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I think it depends on the scale of the problem.</p> <p>You could write some generic JavaScript that shows and hides the form fields (then in the form itself you apply these css classes). This would work well for a relatively small number showing and hiding fields.</p> <p>If you want to go further than that you will need to think about developing dynamic forms in Django. I would suggest you don't modify the ['field'] in the class like Ghislain suggested. There is a good post here about <a href="http://www.b-list.org/weblog/2008/nov/09/dynamic-forms/" rel="nofollow noreferrer">dynamic forms</a> and it shows you a few approaches.</p> <p>I would imagine that a good solution might be combining the dynamic forms in the post above with the <a href="http://docs.djangoproject.com/en/dev/ref/contrib/formtools/form-wizard/" rel="nofollow noreferrer">django FormWizard</a>. The FormWizard will take you through various different Forms and then allow you to save the overall data at the end.</p> <p>It had a few gotchas though as you can't easily go back a step without loosing the data of the step your on. Also displaying all the forms will require a bit of a customization of the FormWizard. Some of the API isn't documented or considered public (so be wary of it changing in future versions of Django) but if you look at <a href="http://code.djangoproject.com/browser/django/trunk/django/contrib/formtools/wizard.py#L19" rel="nofollow noreferrer">the source</a> you can extend and override parts of the form wizard fairly easily to do what you need.</p> <p>Finally a simpler FormWizard approach would be to have say 5 static forms and then customize the form selection in the wizard and change what forms are next and only show the relevant forms. This again would work well but it depends how much the forms change on previous choices.</p> <p>Hope that helps, ask any questions if have any!</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload