jovialjonny
06-10-2003, 11:58 AM
Hi,
I have a form which I intend to submit to a servlet. When the user clicks on the 'submit' button it activates an onClick method that opens a child page and creates an iframe to display the returned form in.
The child page also gives the id of this new iframe back to the opener window which then sets the target of the form to be the new iframe.
That is the idea but it is not targetting correctly and instead the servlet is opening a new IE window and displaying the result in it.
Here is the code:
The Parent window:
<form id= "form" action="/servlet/viewerServlet">
<input type="Button" onclick="openViewer()" value="Subscribe" />
</form>
The Parents JavaScript file:
function openViewer()
{ if(viewer==null || viewer.closed==true)
{ viewer = window.open("multiviewer.html");
}
else
{ addPage();
}
}
function addPage()
{ /*This function in the child page
creates the frame and returns its id*/
var frameId = viewer.createTab();
//This gets the relevant form.
var form = document.getElementById("form");
form.target = frameId;
form.submit();
}
Does anyone know how I can get the servlet to return to the relevant iframe like I want it to? I thought it might be a problem of ids versus names but I tried supplying a frame name instead and it had no effect.
Any suggestions would be greatly appreciated thanks.
I have a form which I intend to submit to a servlet. When the user clicks on the 'submit' button it activates an onClick method that opens a child page and creates an iframe to display the returned form in.
The child page also gives the id of this new iframe back to the opener window which then sets the target of the form to be the new iframe.
That is the idea but it is not targetting correctly and instead the servlet is opening a new IE window and displaying the result in it.
Here is the code:
The Parent window:
<form id= "form" action="/servlet/viewerServlet">
<input type="Button" onclick="openViewer()" value="Subscribe" />
</form>
The Parents JavaScript file:
function openViewer()
{ if(viewer==null || viewer.closed==true)
{ viewer = window.open("multiviewer.html");
}
else
{ addPage();
}
}
function addPage()
{ /*This function in the child page
creates the frame and returns its id*/
var frameId = viewer.createTab();
//This gets the relevant form.
var form = document.getElementById("form");
form.target = frameId;
form.submit();
}
Does anyone know how I can get the servlet to return to the relevant iframe like I want it to? I thought it might be a problem of ids versus names but I tried supplying a frame name instead and it had no effect.
Any suggestions would be greatly appreciated thanks.