Click to See Complete Forum and Search --> : Dynamic table help


Fishamit
June 5th, 2008, 07:55 AM
Hi

I need to write a dynamic table, which will be viewed in a browser, where anyone can actually add a new row.
for example, say there's a table with columns "name", "phone" and "address". there are some entries, and right below the table there should be name, phone and address fields and a "submit" button, which will add the entries to the table. the table must also save (don't know the simplest way to do that, i'm guessing save into an XML file?)

now what would be the simplest way to achieve something like that?

PeejAvery
June 5th, 2008, 09:04 AM
Please think of searching before you post. Google would have found this (http://www.google.com/search?source=ig&hl=en&rlz=&q=javascript+table+add+row&btnG=Google+Search[/url) for you so you would not have had to wait an hour to get results.

Basically, all you need is insertRow() (http://www.w3schools.com/HTMLDOM/met_table_insertrow.asp), insertCell() (http://www.w3schools.com/htmldom/met_tablerow_insertcell.asp), and deleteRow() (http://www.w3schools.com/htmldom/met_table_deleterow.asp).

Fishamit
June 5th, 2008, 11:18 AM
I did search google and found some nice source files, but my problem is how the data will be saved.

with JS if the user would add his row, close the window and then open a new one the row won't be there. I need the rows to save

PeejAvery
June 5th, 2008, 01:13 PM
Saving of data cannot be done on the client-side. You are going to have to use a server-side language to save to a text file or database. Using a database would be much smarter.

Fishamit
June 5th, 2008, 05:04 PM
OK, thanks!