This is what I would do - make a single for that contains all fields you need - use jQuery in the view so that depending on the selected department some fields are hidden
On Jun 21, 3:38 am, Andrew Buchan <andyha...@gmail.com> wrote: > Hello, > > I am trying to make a form for inserting a new record representing an > internal complaint against a given department. Depending on which department > is selected, different fields must be completed. > The way I'm planning on doing this is with a simple form with a select box > for the department, a DIV, and a submit button. On changing the department > selection, the DIV will be refreshed to display only those fields applicable > to that department (all of which correspond to a field in the DAL). > > 1. Where I'm having trouble is in generating the HTML fields based on the > names of a field in the DAL. I have previously always just used SQLForm and > sized it down to suit by passing a list of fields, but think that in this > situation, and many others, it would be useful to build a form from fields > obtained by passing the name of a field in the DAL and getting the > validators brought through automatically. > > 2. Also, if I manage to do this, will there be an issue with the fact that > some of the fields in the form are nested in a DIV, will the fields still > auto-validate? From recollection placing a whole form within a DIV doesn't > work so didn't want to do that... > > Cheers..