views:

106

answers:

1

I have a complex form containing an inline formset, which basically has got some text fields and a file upload field. Now, I want to enable the user to create a new record, and within the same step attach several files.

I think there are different options to achieve this, maybe I could write a jQuery-Plugin that clones the formset, do all the validation and inserting stuff manually in the view etc.

The main point before I begin is: I wonder if there isn't any solution out there that takes cares of the problem - in my opinion, this is a very common problem.

Maybe there is some approach of a solution I did not notice?

A: 

If you basically just want an "Add another" or + link that adds a new section to your form a nice approach is to write a dumb section in plain HTML then hide it with css and use cloneNode(true) to make a copy. As long as you don't use ids you should be able to cleanly generate many copies with very little JS code.

Tom
Yes, this would be possible, but this is only the client side. Will I have to implement all the server side stuff on my own or ist there any existing functionality I could use?
schneck