Your "editItem" action, when the update is finished, forwards to "autoCloseAndReloadOpener.jsp"

autoCloseAndReloadOpener.jsp does steps (5) and (6):

<html>
<body onLoad="self.close()">
   <script>
      // Reload opener
      opener.formReload.submit(); // or something like this, using "opener"
   </scrip>
</body>
</html>

I have not tried it...
Regards
PD. This is not struts related.

[EMAIL PROTECTED] wrote:

Hello bOOyah,

I have had the same problem that you describe. Were you able to solve it?. If so could you share how you did it?

Sam

-----Ursprungliche Nachricht-----
Von: news [mailto:[EMAIL PROTECTED] Auftrag von bOOyah
Gesendet: Donnerstag, 11. Marz 2004 11:43
An: [EMAIL PROTECTED]
Betreff: Q: How to submit form in pop-up window and forward parent
results page?


Hi all.


(Caveat: this might actually turn out to be a Javascript question):

I would appreciate any help or even alternatives to what I'm trying to achieve below:-

Here's a rough sequence of what I'm trying to achieve...

(1) My app has a page displaying an item link.

(2) When the user clicks on the link a pop-up browser window appears with a form containing all the details about that item.

(3) After modifying the item's details the user clicks on the form Submit button.

(4) The Submit action saves the changes to the database.

(5) The pop-up windows closes.

(6) The original, parent page 'refreshes' to reflect the changes the user made in the pop-up windows (e.g. changing the name of the item under the link).

I can get as far as step (4) using Struts and Javascript handlers.

Here's how my parent pops-up the item editing window:
----------

<% String link = "javascript:popUp('"+
    request.getContextPath()+
    /editItem.do?action=edit&item="+
    itemID + "');";
%>
. . .
<td><html:link href="javascript:;" onclick="<%=link%>">
    <c:out value="Edit Item"/></html:link>
</td>

----------


Here's the form element of my pop-up: ----------

<% String submitScript = "form.submit();
    opener.location='"+
    request.getContextPath()+
    "/showItemDetails.do';"+
    "self.close();";
%>
. . .
<html:form action="/saveItem" onsubmit="<%=submitScript%>">

----------


So I'm submitting the form, telling the parent to forward to the results page ('/showItemDetails.do') and closing the pop-up.


But it doesn't work that way:-(

The submission works fine; the data is written to the DB. But the pop-up browser window doesn't close and the parent isn't forwarded to the results page. So I guess once a form is submitted the rest of the Javascript just 'disappears' and isn't executed?

Any help out there..?

Many thanks in advance!



--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to