Jack,
I seem to remember having problems in a project with similar rqmnts some time ago.
I *think* your problem lies here:-
target="x" onsubmit="window.open('',this.target
Where in NS the form appears to submit before the new window is registered, and hence the window target is not valid. I could be wrong though.
We prefer to separate the JS into different functions and call the form from an onClick event.
This way we know we have a target before form submission, and we gain common JS functions so we don't need to mess with the JSPs too often :)
// --------------- Javascript ------------------- //
<script> function submitForm(formName)
{
// get the form element
var form = eval(createObjectRef(formName));
// open the window
openNewWindow('#','New_Window','width=600,height=745,menubar=no,resizable=no,scrollbars=no,status=yes');
// set the form target
form.target = 'New_Window';
// submit it to the target
form.submit();
}
function createObjectRef(name) { var obj = null; if (document.getElementById != null) { // MS obj = document.getElementById(name); } else if (document.all) { // NS obj = document.all[name]; } return obj }
function openNewWindow(URL,windowName,features) { newin = window.open(URL,windowName,features); } <script>
// --------------- End Javascript ------------------- //
<html:form action="/EditObject" styleId="EditObject"> <html:hidden property="objectid" value="${object.objectid}" /> </html:form>
<a href="#" onClick="submitForm('<c:out value="EditObject" />');"> edit [<c:out value="${object.name}" />] </a>
// ---------------- END --------------------------------//
Cheers
James.
Dakota Jack wrote:
Man, you guys are hot and helpful today. Thanks loads! I have another question from an earlier helpful suggestion regarding Netscape. I am testing the following code and it works in everything but Netscape. With Netscape, nothing happens. Anyone know what the issue is?
Jack
<html:form method="post" action="album_photo.CRACKWILLOW" target="x" onsubmit="window.open('',this.target, location='0', directories='0', status='0', menubar='0', 'scrollbar='2', toolbar='0', resizable='0', copyhistory='0',width='5000' height='5000',);return true;"> <html:image src='resource.CRACKWILLOW?file=ALBUM.gif' property='yo.method'/> <!-- put radio values in here --> </html:form>
On Apr 5, 2005 5:03 PM, Smith, Thad <[EMAIL PROTECTED]> wrote:
The window.open javascript method takes an optional target which is the named frame/window that you want to be the destination output. There are a few built in names such as _parent, _blank, _self that serve special purposes.
If the browser is unable to find a frame called "dontCareThatName", it attempts to find a window called "dontCareThatName". If it is unable to find a window with that name it will open a new window altogether...hence "dontCareThatName" will open a new window the first time this method is called. Any subsequent calls to window.open with a target of "dontCareThatName" will send the output to the opened window. To guarantee that a new window is opened every time use "_blank".
Regards,
Thad Smith
-----Original Message----- From: Dakota Jack [mailto:[EMAIL PROTECTED] Sent: Tuesday, April 05, 2005 6:25 PM To: Struts Users Mailing List Subject: Re: Popup Windows with Struts Actions
This looks cool to me as well. What is with the target="dontCareThatName"? Is this necessary, and, if so, what should "dontCareThatName" be? Thanks,
On Apr 5, 2005 2:29 PM, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
Dakota Jack wrote:
Anyone have some code on using JavaScript to open and close popup windows with a Struts Action? Thanks.
Jack
I like very much:
<html:form action="/yourAction" ... target="dontCareThatName" onsubmit="window.open('',this.target,'scroolbar=no,
toolbar=no');return
true;"> <html:text...> <html:hidden> </html:form>
The output of yourAction will be shown in the popup, and all your form fields are brought the normal way to yourAction with no need to put them into a big query string after the url in the open() function.
Wolfgang
-- "You can lead a horse to water but you cannot make it float on its back." ~Dakota Jack~
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]