File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Geting a Cell Content Value

 
Steve Dyke
Ranch Hand
Posts: 1602
1
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How can I get the value of a cell when I click on its contents? I want to copy this value to another text box.

This is how I populate the table on my form:

 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64192
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
From the Help Yourself Kiosk(tm):

1) How do you detect the click on the <td>?

2) Once detected, how would you get a reference to the clicked element?

3) Once you have the refernce, how do you get its content?
 
Steve Dyke
Ranch Hand
Posts: 1602
1
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If I am reading your post correctly I need ssome help for all three of these questions you have asked me. Where do I put the onclick, how does javascript use DOM to identify the actual cell, assign cell value to another control.

I am not sure this is what you asked or needed from me.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64192
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Right, so you've determined that an onclick handler is needed. Where do you put it? Well, what element do you want to be sensitive to the click?
 
Steve Dyke
Ranch Hand
Posts: 1602
1
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
While I was waiting on your reply I modified my code some. I hope I am heading in the right direction.

I can't seem to post the code. Get error about using "<" which I had before and it posted okay. Anyway I am using scriplet to give each row and cell a dynamic id. Then I do an onclick on the cell to get the id and onclick on the row to get row id. Then I use these values on the table id to get the innerHTML contents of that coordinate.

Does this sound right?
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64192
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you are wanting to get the content of a cell upon clicking it, why would you need a handler on the row?
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic