Can't get values from textFields in table bounded to database
Hi all.
I've seen similar problems to this one, but not quite the same.
In my app I want the user to save different kind of data, for that, the user fills some textFields, selects dropdowns, etc. that are located in different tabs. After the user has filled all the data, it clicks the Save button. All the data is saved, except a table with textFields bounded to a database.
When I fill that table, then go to other tab and then come back to the table tab, the textfields are empty (it uses a dataprovider as data entry). It doesn't happen with the other components, the data is persistent with them in every render.
So, I guess that I can save the data in a SessionBean property, like an ArrayList and then save it in the database when the Save button is pressed. But I don't know how to get the values from those textFilds. I can't do something like textField1.getValue(), because it is in a table, and the number of rows may vary.
But if I save the data when the tab (where the table is) is selected, then the data is saved.
Any ideas on how to do this?
[1104 byte] By [
linuc@] at [2007-11-26 11:04:38]

# 1
You might wat to check out this (somewhat long but informative) thread:
http://forum.sun.com/jive/thread.jspa?forumID=123&threadID=94671
Note that, "I found that because of a bug, you have to call <your object list data provider>.commitChanges() method for every page submit."
and other issues related to your problem are covered.
Also:
http://forum.sun.com/jive/thread.jspa?forumID=123&threadID=64182
This tutorial has a bound table with text fields and drop down lists. http://developers.sun.com/prodtech/javatools/jscreator/learning/tutorials/2/ins erts_updates_deletes.html.
# 2
Thanks for your replay.
As you say, in those threads, issues related to my problem are covered, but not yet solved.
The solution <my object list data provider>.commitChanges() method for every page submit, is not what I need. The data has to be saved only when the Save button is pressed. What if the user presses the cancel button because he doesn't want the data to be saved but the table data had already been saved? What if the user closes the window before pressing the Save button but the table data had already been saved?
The data of that table is going to be saved in every render, that's quite not what I need.
I saw the tutorial you mentioned, but it only works fine as long as you don't have to rerenderize the page.
I hope someone find the solution.