how to open pop-up using gx_window

Hi All,
I have a requirement to open a Pop-up. I have created two generated/customized jsps.say (parent.jsp,child.jsp).

I have implemented the following stuff in parent.jsp for opening pop-up,
////==========================================
function PopUPOpen(){
gx_window.open(“child.jsp”,200,300,0,0);
}

////==========================================

I am getting a js error (‘gx_window is undefined’).

Also I would like to mention it is not necessary to open a pop-up using javascript, is there any other way in server side to do the same then please suggest.

Thanks in advance.
Arijit

Hi Arijit,

It would really help us to know what are you trying to achieve.
Does the child window represent a host-window or does it suppose to be independent page opened from the parent page?

Does the parent.java class extends GXDefaultContext or GXBasicContext?

And again, please describe the scenario you’re trying to implement both on the client side as well as the Host side. This way we’ll be able to better understand the problem you’re facing.

Best regards,
Ohad

Hi Ohad,
Thanks for your quick response…

Find my answers below…

  1. Does the child window represent a host-window or does it suppose to be independent page opened from the parent page?

ANS : Child window represents a host-window… in mainframe this child window is a main screen (not a pop up).

  1. Does the parent.java class extends GXDefaultContext or GXBasicContext?

ANS: parent.java extends GXDefaultLogicContext.

The business requirement is to provide the user input data from a Look-up screen (which is currently getting displayed as a Host Screen by pressing a PF-Key from the parent screen in mainframe) as a pop-up from the parent screen.

Hi,

Please suggest how gx_window.open can be used to open a new window ? Not sure what else needs to be done to successfully invoke the gx_window.open JS.

Please help

Aki, Arjit,

what should be done is the following:

Change GXBasicContext methods

public void gx_changeNextForm(GXIHostPageContext gx_context,GXChangeNextFormEvent event)throws GXGeneralException{
// Occurs before loading the next page, by gx_handleHostResponse.
// Use event.setNextForm(“”), for example logon.jsp , to change the next page.
String curScr = gx_context.getGXSession().getScreen().getName();
if (curScr.equals(“”)){
event.setLoadAsWindow(true);
}
}

Then:

public void gx_preOpenWin(GXIHostPageContext gx_context,GXPreOpenWinEvent event) throws GXGeneralException{
if (gx_context.getGXSession().getScreen().getName().equals(“”)){
event.setOpenWin(true);
}
}

Changing that code SHOULD open the screen in a new window, however, there is a bug and the window doesn’t open. Please open a support request for that and use the code above once that bug is solved.

Thanks!

Tanya

I have implemented mentioned changes in the GXBasicContext, but it is opening parent window instead of client window in the pop-up.

Note: Client window is an independent page opened from the parent page,

<%@ page extends=“com.sabratec.j2ee.framework.web.GXJspServlet”%>
<%@ taglib uri=“com/sabratec/j2ee/framework/tags” prefix=“gx” %>
<%@ page contentType=“text/html; charset=utf-8” %>
<gx:html gx_context=“contexts.ChildScreen”>



gx:form




This is example page.

					</td>
				</tr>
				
			</table>
		</div>
	</gx:form>
</body>

</gx:html>

Hello Puneet,

Please look in ApplinX documentation at the topic: Opening an Independent Pop-up Box that doesn’t have a Corresponding Host Screen.

Hope it helps

Regards,
Assaf

now i am getting “gx_window is undefined” after implementing suggested changes in the corresponding files.

I am using Applinx 5.2.5.0047, and have commented earlier suggested changes also but getting the same “gx_window is undefined” java script error message. earlier, it was opening parent window, now it is not opening any window.

Note: Could you please provide me link where I can see differences between old and new versions.

Earlier Suggested changes in this post:

Change GXBasicContext methods

public void gx_changeNextForm(GXIHostPageContext gx_context,GXChangeNextFormEvent event)throws GXGeneralException{
// Occurs before loading the next page, by gx_handleHostResponse.
// Use event.setNextForm(“”), for example logon.jsp , to change the next page.
String curScr = gx_context.getGXSession().getScreen().getName();
if (curScr.equals(“”)){
event.setLoadAsWindow(true);
}
}

Then:

public void gx_preOpenWin(GXIHostPageContext gx_context,GXPreOpenWinEvent event) throws GXGeneralException{
if (gx_context.getGXSession().getScreen().getName().equals(“”)){
event.setOpenWin(true);
}
}

Hi Punnet,

I’ve tested the solution I referred to in the JSP CompositeDemo and it worked, so I assume that there are some other things in your web page which prevent from the gx_window object to load. Please open a support request and provide your web application.
Please note that the version you have is out of support. I recommend upgrading to a newer version.

Regarding the earlier suggested changes in this post, this is not exactly your use case. The use case there is to open a window of the host screen as a popup though it is not a real window in the host application.
The solution that you ask for is to open a popup window which is not related to a host screen at all.

Regards,
Assaf