Javascript within a remote div is not evaluated by default. Not sure
about s:div, but sx:div has executeScripts which must be set to true.

Owen

On Fri, Sep 5, 2008 at 6:01 AM, Pablo Vázquez Blázquez
<[EMAIL PROTECTED]> wrote:
> Hi!!
>
> If I have the following code in a jspx loaded via <s:div>, when I go to
> another page (also loaded via <s:div>) the "onbeforeunload" event is not
> triggered. It is only triggered when the page is not loaded using ajax.
>
> What can I do to make it works both when the page is downloaded at all from
> server and when only a part is using ajax (using <s:div> tag)?
>
> <jsp:root xmlns="http://www.w3.org/1999/xhtml";
>   xmlns:jsp="http://java.sun.com/JSP/Page";
>   xmlns:fmt="http://java.sun.com/jsp/jstl/fmt";
>   xmlns:c="http://java.sun.com/jsp/jstl/core";
>   xmlns:s="/struts-tags"
>   xmlns:scheduler="/scheduler-html.tld"
>   version="2.0">
>
> <script type="text/javascript">
>       onbeforeunload = function() {
>           if (formIsDirty(document.forms[1])) {
>               return confirm('Unsaved changes. Do you want to continue?');
>           }
>       }
>   </script>
>
> <s:form id="editDataSource" name="editDataSource" theme="ajax"
>       action="UpdateTagDataSource" method="POST">
> ...
> </s:form>
>
>  </jsp:root>
>
> Thanks.
>
> ---------------------------------------------------------------------
> 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]

Reply via email to