Re: Adding new forms dynamically to the page?

2008-11-30 Thread Steve Bergman
I'm not expert at this. I've only used formsets a little, and I've never added any dynamically. But depending upon your requirements, you could define the formset with an adequate number of "extra=" forms and have the javascript hide most of them by default, displaying an additional one each

Re: Adding new forms dynamically to the page?

2008-11-30 Thread Zeroth
Thanks Steve. I've got the server-side portion done, just need to now work on the javascript. :) On Nov 30, 9:02 am, Steve Bergman <[EMAIL PROTECTED]> wrote: > When you add a form with javascript, you must also increment the > hidden field in the management form which holds the form count. >

Re: Adding new forms dynamically to the page?

2008-11-30 Thread Steve Bergman
When you add a form with javascript, you must also increment the hidden field in the management form which holds the form count. Actually, you'll need to read that field before you add the form to determine what the proper ids and names for the new input elements should be. Validation will then

Re: Adding new forms dynamically to the page?

2008-11-30 Thread Zeroth
So to clarify, I'd be modifying the new rows on the client side, correct? On Nov 29, 9:47 pm, "Felipe Sodré Silva" <[EMAIL PROTECTED]> wrote: > I don't see why it wouldn't. > > On Sun, Nov 30, 2008 at 3:42 AM, Zeroth <[EMAIL PROTECTED]> wrote: > > > Thanks Felipe for your quick answer. Does that

Re: Adding new forms dynamically to the page?

2008-11-29 Thread Felipe Sodré Silva
I don't see why it wouldn't. On Sun, Nov 30, 2008 at 3:42 AM, Zeroth <[EMAIL PROTECTED]> wrote: > > Thanks Felipe for your quick answer. Does that still get validated > properly? > > On Nov 29, 9:20 pm, "Felipe Sodré Silva" <[EMAIL PROTECTED]> wrote: > > You can easily add new rows to the form

Re: Adding new forms dynamically to the page?

2008-11-29 Thread Zeroth
Thanks Felipe for your quick answer. Does that still get validated properly? On Nov 29, 9:20 pm, "Felipe Sodré Silva" <[EMAIL PROTECTED]> wrote: > You can easily add new rows to the form with ids 'rowN', where N is the > number of rows, and also modify a hidden element that tells how many >

Re: Adding new forms dynamically to the page?

2008-11-29 Thread Felipe Sodré Silva
You can easily add new rows to the form with ids 'rowN', where N is the number of rows, and also modify a hidden element that tells how many elements are there in the form so far. This is more elegant than string manipulation, and also more efficient. Cheers, Felipe On Sun, Nov 30, 2008 at 3:01

Adding new forms dynamically to the page?

2008-11-29 Thread Zeroth
I'm making essentially a wishlist webapp(for fun). However, I would like to make it so that the user can press a button, and add another row for entering an item, via AJAX. My issue is making sure that the webserver processes all the data properly. I've been looking at formsets, and maybe using a