posted 15 years ago
Hi,
I have a main page with a datatable. Also I have a link which opens a popup window for adding a new raw in the datatable.
I want when I click the Add button in the window, the data to be added in the database, the window to close and the page containing the datatable to be refreshed.
The button is like this:
<h:commandButton action="#{itemBean.actionAddItem}" value="Add" onclick="window.opener.location.reload();window.close();" >
When I click the button the data is added in the database and the window is closed, the problem is that the main page is not refreshed. I know that the onclick is executed before the action, so therefore the page is not refreshed with the new value. What can I do?
Also in this way, I cannot validate the form from the window, because the window is closed before the validation messages are displayed.
Can anyone help me?