> From: Jillian Koskie [mailto:[EMAIL PROTECTED] 
> I have a form that adds content to a database --but I need to 
> be able to allow my user to dynamically add rows (for 
> additional authors) to the form... because he never knows how 
> many authors there will be.

> So I need a way to add the lines without reloading the 
> page/losing the form data (or do I have to just populate the 
> form with 'form variables'?).  I also need a way to loop 
> through the results and insert them into the database.

What I have done in the past is first come up with a naming convention
for that "group" of form fields. In your case, let's say it is called
Author. Using some JS you can dynamically add rows to the table/form and
name them Author1, Author2, Author3, etc. Each of these new form
elements goes in a new row which is contained within a TBODY. Using
another little bit of JS, set a hidden form field "AuthorCount" equal to
the row count (use JS to get this also). Submit the form. On the
processing page you can use AuthorCount to help you loop over all the
Author fields. Let me know if you need some specific code help... I have
done this a couple times.

Mike

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Logware (www.logware.us): a new and convenient web-based time tracking 
application. Start tracking and documenting hours spent on a project or with a 
client with Logware today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:214759
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to