On Thu, Aug 20, 2009 at 7:27 AM, Andew Gee<gee.webm...@gmail.com> wrote:
>
> Does anyone know how to add a new line to anlineformset dynamically? I
> have a page that contains an inlineformset and I need to be able to
> click a button and add a new line which will then be saved when the
> form is submitted, is that possible?

Sure it is. Clone the HTML of the last line (or any empty line),
modifiy the id and name attributes (increment the counters by one) and
increment the TOTAL-FORMS hidden input field. There is no builtin
support for doing that in Django, because it is javascript framework
agnostic, but it's quite easy to do it anyway.

Maybe you find some inspiration how to do it in the admin-ui GSoC
branch? There, jQuery is used to provide exactly what you want.

Matthias


-- 
FeinCMS Django CMS building toolkit: http://spinlock.ch/pub/feincms/

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to