How to update a bound textField with user selection ?
Hi all,
I'm following an Update Database example from the JSC tutorials and have the following situation.
I have a page displaying a row of data for a selected person (first_name, last_name, title) bound to a data provider. I have made the "title' field a TextField. I want to enable the user to edit the title field and update the information in the database.
If I simply type a new title on the text field and click on Update, everything works fine. However, I want to make the user choose from a list of titles (in a drop down list) instead of manually editting the 'title
field to avoid spelling errors.
However, the textfield (title) does not display the selection from the Drop Down list.
titleField.setText(rankdropDown.getSelected());
It seems to me that the reason is that each time the drop down event value change event handler is executed, the Pre-render methd kicks in and restores the 'title' field to its original value (from table rowset). And the user selection is not displayed.
public void prerender() {
try {
getSessionBean1().getStudent_infoRowSet1().setObject(1, getSessionBean1().getLoginBean().getUsername());
student_infoDataProvider1.refresh();
} catch (Exception e) {
Can someone please suggest a solution?
Thanks.
Nakul

