Problem

How can I open a form in a modal window, and read the values of the components present on the form.


Solution

To open a form you should use the following code:

//Create the window
dataweb.client.Window wnd = new dataweb.client.Window(dataweb.client.Window.DIALOG_MODAL,thisForm.getContainer());
wnd.setDefaultCloseOperation(dataweb.client.Window.HIDE_ON_CLOSE);

//Open the form
dataweb.client.components.Form frm = client.openForm(session, "<package>.<form>" ,wnd ,thisForm);

//Show the window (since the window is modal waits until it is closed)
wnd.show();

//Reads the value of the components of the form
String val = frm.getComponent("textBox2").getText();

//Destroy the window and the form
wnd.dispose();

Published in Fri, 10 December 2010 17:38