File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes HTML, CSS and JavaScript and the fly likes Add a row to table and update data Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Add a row to table and update data" Watch "Add a row to table and update data" New topic
Author

Add a row to table and update data

Lisa Zapson
Ranch Hand

Joined: Nov 22, 2004
Posts: 50
I would like to add a row to a html table and the column (<td> will be an input field with type=text. I would like to name the input field and be able to update it using the name.

I can crete a table with a input field column, name it and update it.

I can add a row to table.

I can not add a row to a table with a input field column.

Any suggestions would be much appreciated, Lisa
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
Would this help?
http://www.mredkj.com/tutorials/tableaddrow.html

Eric
Lisa Zapson
Ranch Hand

Joined: Nov 22, 2004
Posts: 50
Thanks,

I can add a row to a table, just like your link describes. But I can not figure out how to add a row as a input field.

<td><input type=text name="newColumn" value="new"></td>

I would like to add it as an input field so I can update it using the name attribute.

Thanks so much for your help, any other ideas would be appreciated. Lisa
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
that code inserts a text filed so you can edit it by:

var theBlah = document.formName("txtRow" + number).value;

Eric
Lisa Zapson
Ranch Hand

Joined: Nov 22, 2004
Posts: 50
Thanks for pointing that out. I will try it.

Thanks for your help, Lisa
Lisa Zapson
Ranch Hand

Joined: Nov 22, 2004
Posts: 50
I can not seem to access the row I inserted by referencing the name.

I am not using a form. I tried using a form and it didn't seem to make a difference.

If I add a row to a table

<td><input type="text" name="txtRow1" size="40" /></td>
I try to change the value of the row in a javascript function
txtRow1.value = "100"
it works fine.

If I add a row dynamically using the code in http://www.mredkj.com/tutorials/tableaddrow.html I am not able to update the row later by name. Even when I view source the row does not display in the source.

Any thoughts? Lisa
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Add a row to table and update data