Wicket
  1. Wicket
  2. WICKET-1003

Modal Window Does Not Close When Using IndicatingAjaxButton

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Cannot Reproduce
    • Affects Version/s: 1.3.0-beta4
    • Fix Version/s: 1.3.5
    • Component/s: wicket-extensions
    • Labels:
      None
    • Environment:
      Ubuntu, Jetty, Eclipse

      Description

      I have a panel in my modal window. I have a button in my panel that closes the modalwindow.
      If I use an indicatingajaxbutton for that button, the modalwindow does not close properly.

      However if i use an ajaxlink, things go smoothly.

      1. quickstart-closeDoesntWork.zip
        4.00 MB
        Russell Morrisey
      2. project.tar.gz
        12 kB
        Dmitry Kandalov
      3. Modal.png
        280 kB
        Carlo M. Camerino

        Activity

        Hide
        Sym Frog added a comment -

        I am using wicket 1.3.4 and experienced the same problem.

        It works for me if I set the containing form's setOutputMarkupId(true)

        Show
        Sym Frog added a comment - I am using wicket 1.3.4 and experienced the same problem. It works for me if I set the containing form's setOutputMarkupId(true)
        Hide
        Pas Filip added a comment - - edited

        I've had a similar problem with the modal window that it refuses to close in firefox and ie6.
        I only got this problem if using a modal window with a panel for content, using a page all seems to work fine.
        I also got this problem in a form. In a testcase i made without forms the problem didn't present itself.
        Also I wasn't using an ajaxindicating button but a plain AjaxButton (that submits the form).
        The problem seems related to the way the timeout is being called that will close the modal window.
        It seems for some reason window.parent doesn't return a window object but instead returns some html div element.
        Isn't window.parent ALWAYS supposed to return a window object?
        Is it possible that some of the js for wicket modal window modifies this parent?

        I used the following code to get the modal window to close.
        Basically I test if window.parent has a setTimeout method.
        If it does I use that to call the timeout and if it doesn't I use window.setTimeout instead of
        window.parent.setTimeout. See below for the sample code.

        Another thing I thought could be improved about the modalwindow is that the code to close the modalwindow
        be a template method which by default calls the static closecurrent method.
        Also it could be useful to add a setShown method with protected visibility so people who override can set the shown flag appropriately.

        Here's my implementation of the close method on the modal window:

        public class ModalWindow extends org.apache.wicket.extensions.ajax.markup.html.modal.ModalWindow{

        private final static Field shownField;

        static {
        try

        { shownField = org.apache.wicket.extensions.ajax.markup.html.modal.ModalWindow.class.getDeclaredField("shown"); shownField.setAccessible(true); }

        catch ( SecurityException e )

        { throw new RuntimeException("failed locating shown field on modalwindow due to security setting",e); }

        catch ( NoSuchFieldException e )

        { throw new RuntimeException("failed locating shown field on modalwindow",e); }

        }

        public ModalWindow( String id )

        { super( id ); }

        public void close( AjaxRequestTarget target ) {
        String script = " var win;\n"
        + "try

        {\n" + " win = window.parent.Wicket.Window;\n" + "}

        catch (ignore) {}\n"
        + "if (typeof(win) == \"undefined\" || typeof(win.current) == \"undefined\") {\n"
        + " try

        {\n" + " win = window.Wicket.Window;\n" + " } catch (ignore) {}\n"
        + "}\n"
        +" var timeoutExecutor = window; \n if ( window.parent.setTimeout ) { timeoutExecutor = window.parent; } \n"
        + "if (typeof(win) != \"undefined\" && typeof(win.current) != \"undefined\") {\n"
        + " timeoutExecutor.setTimeout(function() {\n" + " win.current.close();\n" + " }, 0);\n"
        + "} ";
        target.appendJavascript(script);
        setShown(false);
        }


        public void setShown(boolean shown) {
        try { shownField.setBoolean(this, shown); } catch ( IllegalArgumentException e ) { throw e; } catch ( IllegalAccessException e ) { throw new RuntimeException("could not invoke field shown",e); }
        }
        }


        Update:
        Actually the code doesn't fix all issues. In some cases we're unable to close the modalwindow the first time it is shown. Using a custom button on the modalwindow did manage to close it.
        Funny thing is the second time the window is show the close button (at the top left does work.)

        Second Update:

        After running some tests with a modified javascript I got the modalwindow to work in all situations in which we were using it. The solution seems to be to change the order of initialization of the win variable.
        Here's what were using now:

        public void close( AjaxRequestTarget target ) {
        String script = " var win;\n"
        + " try {n" + " win = window.Wicket.Window;n" + " }

        catch (ignore) { }\n"

        + "if (typeof(win) == \"undefined\" || typeof(win.current) == \"undefined\") {\n"
        + "try

        {\n" + " win = window.parent.Wicket.Window; \n" + "}

        catch (ignore) { }\n"
        + "}\n"
        +" var timeoutExecutor = window; \n if ( window.parent.setTimeout )

        { timeoutExecutor = window.parent; }

        \n"
        + "if (typeof(win) != \"undefined\" && typeof(win.current) != \"undefined\") {\n"
        + " timeoutExecutor.setTimeout(function()

        {\n" + " win.current.close();\n" + " }

        , 0);\n"
        + "} ";
        target.appendJavascript(script);
        setShown(false);
        }

        Update nr 3:

        The solution I proposed still has issues in IE.
        I finally figured out that it was my submit button which wasn't working.
        Apparently having a masterform that contains a modalwindow that contains a form causes problems for IE, firefox seems to be able to handle it alright.
        If you used the pagecreator approach you won't have this problem as the form isn't nested.
        One of the things I noticed with IE is that there occurs a socket connection error with message
        connection with peer reset. which leads to all ajax calls being blocked.

        Show
        Pas Filip added a comment - - edited I've had a similar problem with the modal window that it refuses to close in firefox and ie6. I only got this problem if using a modal window with a panel for content, using a page all seems to work fine. I also got this problem in a form. In a testcase i made without forms the problem didn't present itself. Also I wasn't using an ajaxindicating button but a plain AjaxButton (that submits the form). The problem seems related to the way the timeout is being called that will close the modal window. It seems for some reason window.parent doesn't return a window object but instead returns some html div element. Isn't window.parent ALWAYS supposed to return a window object? Is it possible that some of the js for wicket modal window modifies this parent? I used the following code to get the modal window to close. Basically I test if window.parent has a setTimeout method. If it does I use that to call the timeout and if it doesn't I use window.setTimeout instead of window.parent.setTimeout. See below for the sample code. Another thing I thought could be improved about the modalwindow is that the code to close the modalwindow be a template method which by default calls the static closecurrent method. Also it could be useful to add a setShown method with protected visibility so people who override can set the shown flag appropriately. Here's my implementation of the close method on the modal window: public class ModalWindow extends org.apache.wicket.extensions.ajax.markup.html.modal.ModalWindow{ private final static Field shownField; static { try { shownField = org.apache.wicket.extensions.ajax.markup.html.modal.ModalWindow.class.getDeclaredField("shown"); shownField.setAccessible(true); } catch ( SecurityException e ) { throw new RuntimeException("failed locating shown field on modalwindow due to security setting",e); } catch ( NoSuchFieldException e ) { throw new RuntimeException("failed locating shown field on modalwindow",e); } } public ModalWindow( String id ) { super( id ); } public void close( AjaxRequestTarget target ) { String script = " var win;\n" + "try {\n" + " win = window.parent.Wicket.Window;\n" + "} catch (ignore) {}\n" + "if (typeof(win) == \"undefined\" || typeof(win.current) == \"undefined\") {\n" + " try {\n" + " win = window.Wicket.Window;\n" + " } catch (ignore) {}\n" + "}\n" +" var timeoutExecutor = window; \n if ( window.parent.setTimeout ) { timeoutExecutor = window.parent; } \n" + "if (typeof(win) != \"undefined\" && typeof(win.current) != \"undefined\") {\n" + " timeoutExecutor.setTimeout(function() {\n" + " win.current.close();\n" + " }, 0);\n" + "} "; target.appendJavascript(script); setShown(false); } public void setShown(boolean shown) { try { shownField.setBoolean(this, shown); } catch ( IllegalArgumentException e ) { throw e; } catch ( IllegalAccessException e ) { throw new RuntimeException("could not invoke field shown",e); } } } Update: Actually the code doesn't fix all issues. In some cases we're unable to close the modalwindow the first time it is shown. Using a custom button on the modalwindow did manage to close it. Funny thing is the second time the window is show the close button (at the top left does work.) Second Update: After running some tests with a modified javascript I got the modalwindow to work in all situations in which we were using it. The solution seems to be to change the order of initialization of the win variable. Here's what were using now: public void close( AjaxRequestTarget target ) { String script = " var win;\n" + " try {n" + " win = window.Wicket.Window;n" + " } catch (ignore) { }\n" + "if (typeof(win) == \"undefined\" || typeof(win.current) == \"undefined\") {\n" + "try {\n" + " win = window.parent.Wicket.Window; \n" + "} catch (ignore) { }\n" + "}\n" +" var timeoutExecutor = window; \n if ( window.parent.setTimeout ) { timeoutExecutor = window.parent; } \n" + "if (typeof(win) != \"undefined\" && typeof(win.current) != \"undefined\") {\n" + " timeoutExecutor.setTimeout(function() {\n" + " win.current.close();\n" + " } , 0);\n" + "} "; target.appendJavascript(script); setShown(false); } Update nr 3: The solution I proposed still has issues in IE. I finally figured out that it was my submit button which wasn't working. Apparently having a masterform that contains a modalwindow that contains a form causes problems for IE, firefox seems to be able to handle it alright. If you used the pagecreator approach you won't have this problem as the form isn't nested. One of the things I noticed with IE is that there occurs a socket connection error with message connection with peer reset. which leads to all ajax calls being blocked.
        Hide
        Dmitry Kandalov added a comment -

        I have similar problem. See attached quickstart. It seems like modal window fails to close if:

        • modal window is inside form
        • it has form in its content
        • button is clicked on inner form (not necessarily button which closes window)
        Show
        Dmitry Kandalov added a comment - I have similar problem. See attached quickstart. It seems like modal window fails to close if: modal window is inside form it has form in its content button is clicked on inner form (not necessarily button which closes window)
        Hide
        Gerolf Seitz added a comment -

        ryan, can you still provide a quickstart?
        even only that we can take a look at it and decide whether we want to fix this (modal div inside [invisible] form).
        thanks a lot.

        Show
        Gerolf Seitz added a comment - ryan, can you still provide a quickstart? even only that we can take a look at it and decide whether we want to fix this (modal div inside [invisible] form). thanks a lot.
        Hide
        Ryan Daum added a comment -

        For what it's worth, I had this same issue when I placed the <div> for the modal window component inside a Form. I'm not sure if it was the fact that it was in the Form, or the fact that the visibility of the Form was being toggled that caused the issue. In any case, moving the div out one level solved the problem for me.

        Show
        Ryan Daum added a comment - For what it's worth, I had this same issue when I placed the <div> for the modal window component inside a Form. I'm not sure if it was the fact that it was in the Form, or the fact that the visibility of the Form was being toggled that caused the issue. In any case, moving the div out one level solved the problem for me.
        Hide
        Thies Edeling added a comment -

        I had the same problem but can't reproduce it in a quicktest. It seems window.Wicket.Window returned a random dom element, Steven's javascript fixed the thing in my case.

        Show
        Thies Edeling added a comment - I had the same problem but can't reproduce it in a quicktest. It seems window.Wicket.Window returned a random dom element, Steven's javascript fixed the thing in my case.
        Hide
        Steven Katz added a comment -

        — original message —
        From: "ext Matej Knopp (JIRA)" <jira@apache.org>
        Subject: [jira] Commented: (WICKET-1003) Modal Window Does Not Close When Using IndicatingAjaxButton
        Date: November 1, 2007
        Time: 4:19:38 AM

        [ https://issues.apache.org/jira/browse/WICKET-1003?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12539301 ]

        Matej Knopp commented on WICKET-1003:
        -------------------------------------

        Any progress with the quickstart? I don't mind fixing this, but I need to see the usecase for the fix.


        This message is automatically generated by JIRA.
        -
        You can reply to this email to add a comment to the issue online.

        Show
        Steven Katz added a comment - — original message — From: "ext Matej Knopp (JIRA)" <jira@apache.org> Subject: [jira] Commented: ( WICKET-1003 ) Modal Window Does Not Close When Using IndicatingAjaxButton Date: November 1, 2007 Time: 4:19:38 AM [ https://issues.apache.org/jira/browse/WICKET-1003?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12539301 ] Matej Knopp commented on WICKET-1003 : ------------------------------------- Any progress with the quickstart? I don't mind fixing this, but I need to see the usecase for the fix. – This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.
        Hide
        Steven Katz added a comment -

        Hi,

        Sorry, no progress. I haven't had time to create an isolated test case.

        Show
        Steven Katz added a comment - Hi, Sorry, no progress. I haven't had time to create an isolated test case.
        Hide
        Matej Knopp added a comment -

        Any progress with the quickstart? I don't mind fixing this, but I need to see the usecase for the fix.

        Show
        Matej Knopp added a comment - Any progress with the quickstart? I don't mind fixing this, but I need to see the usecase for the fix.
        Hide
        Eelco Hillenius added a comment -

        Assigned version (beta 4)

        Show
        Eelco Hillenius added a comment - Assigned version (beta 4)
        Hide
        Matej Knopp added a comment -

        Hi, by quickstart i mean anything that's isolated (without 3rd party dependencies) and demonstrates the problem. It doesn't even have to be an eclipse project, just component/page classes and markup files are enough.

        Show
        Matej Knopp added a comment - Hi, by quickstart i mean anything that's isolated (without 3rd party dependencies) and demonstrates the problem. It doesn't even have to be an eclipse project, just component/page classes and markup files are enough.
        Hide
        Steven Katz added a comment - - edited

        Hi Matej,
        I'll try and put it together ASAP, thanks! It might be hard to reproduce, though. It only happens on one page of our application and then only in firefox.
        It has something to do with window.parent returning HTMLTableRowElement instead of Window. [just to be sure, by "quiickstart" you mean a copy of the wicket quickstart app that show the problem?]

        Show
        Steven Katz added a comment - - edited Hi Matej, I'll try and put it together ASAP, thanks! It might be hard to reproduce, though. It only happens on one page of our application and then only in firefox. It has something to do with window.parent returning HTMLTableRowElement instead of Window. [just to be sure, by "quiickstart" you mean a copy of the wicket quickstart app that show the problem?]
        Hide
        Matej Knopp added a comment -

        Hi Steven, can you please submit a quickstart that reproduces the problem you have? I don't mind fixing it, but i need to have a testcase.

        Show
        Matej Knopp added a comment - Hi Steven, can you please submit a quickstart that reproduces the problem you have? I don't mind fixing it, but i need to have a testcase.
        Hide
        Steven Katz added a comment - - edited

        I have devised a solution to the problem I am seeing, but have no idea if it is appropriate. I have tested it on both firefox2 and IE7. In ModalWindow the JavaScript for the close action is replaced with what is given bellow. Basically, we store from which root we successfully got the value for win and use that to set the function against.

        return "var win;var par\n" //
        + "try

        {\n" + " win = window.parent.Wicket.Window;par=window.parent\n" + "}

        catch (ignore)

        {\n" + " }

        \n"
        + "if (typeof(win) == \"undefined\" || typeof(win.current) == \"undefined\") {\n"
        + " try

        {\n" + " win = window.Wicket.Window;par=window\n" + " }

        catch (ignore)

        {\n" + " }

        \n"
        + "}\n"
        + "if (typeof(win) != \"undefined\" && typeof(win.current) != \"undefined\") {\n"
        + " par.setTimeout(function()

        {\n" + " win.current.close();\n" + " }

        , 0);\n" + "}";

        Show
        Steven Katz added a comment - - edited I have devised a solution to the problem I am seeing, but have no idea if it is appropriate. I have tested it on both firefox2 and IE7. In ModalWindow the JavaScript for the close action is replaced with what is given bellow. Basically, we store from which root we successfully got the value for win and use that to set the function against. return "var win;var par\n" // + "try {\n" + " win = window.parent.Wicket.Window;par=window.parent\n" + "} catch (ignore) {\n" + " } \n" + "if (typeof(win) == \"undefined\" || typeof(win.current) == \"undefined\") {\n" + " try {\n" + " win = window.Wicket.Window;par=window\n" + " } catch (ignore) {\n" + " } \n" + "}\n" + "if (typeof(win) != \"undefined\" && typeof(win.current) != \"undefined\") {\n" + " par.setTimeout(function() {\n" + " win.current.close();\n" + " } , 0);\n" + "}";
        Hide
        Steven Katz added a comment - - edited

        I just built the trunk and I see this issue. My ModalWindow containes a panel, which contains two AjaxFallbackLinks for Yes | No input. Oddly, the same code works on another page in the same application. Also, I only see this behavior in Firefox, both pages work fine in IE7.

        Additionally, if I add some javascript to the target to pop up an alert box as follows:

        target.appendJavascript("alert(window.parent);\n");

        In the case were it does not work I get: [object HTMLTableRowElement]
        In the case were it works I get: [object Window]

        as the text in the alert box.

        Show
        Steven Katz added a comment - - edited I just built the trunk and I see this issue. My ModalWindow containes a panel, which contains two AjaxFallbackLinks for Yes | No input. Oddly, the same code works on another page in the same application. Also, I only see this behavior in Firefox, both pages work fine in IE7. Additionally, if I add some javascript to the target to pop up an alert box as follows: target.appendJavascript("alert(window.parent);\n"); In the case were it does not work I get: [object HTMLTableRowElement] In the case were it works I get: [object Window] as the text in the alert box.
        Hide
        Russell Morrisey added a comment - - edited

        Thanks, Matej! This resolved my issue. For the record, my app page doesn't use IndicatingAjaxButton; it uses a custom component which extends AbstractLink and implements IAjaxLink. The quickstart does use IndicatingAjaxButton, though, and it seems to be fixed by the new build also. I'm using revision 580071. Also, I am testing for IE 6 only.

        Show
        Russell Morrisey added a comment - - edited Thanks, Matej! This resolved my issue. For the record, my app page doesn't use IndicatingAjaxButton; it uses a custom component which extends AbstractLink and implements IAjaxLink. The quickstart does use IndicatingAjaxButton, though, and it seems to be fixed by the new build also. I'm using revision 580071. Also, I am testing for IE 6 only.
        Hide
        Don Hass added a comment -

        The updated .js file you check in Matej resolved the modal's not closing for me. Although I see others still having issues per comments listed. Not sure if there is another issue at hand then.

        Show
        Don Hass added a comment - The updated .js file you check in Matej resolved the modal's not closing for me. Although I see others still having issues per comments listed. Not sure if there is another issue at hand then.
        Hide
        Carlo M. Camerino added a comment -

        Forgot to mention that the X button in the topright side of the modal window works,
        tis' just the no button that doesn't

        Show
        Carlo M. Camerino added a comment - Forgot to mention that the X button in the topright side of the modal window works, tis' just the no button that doesn't
        Hide
        Carlo M. Camerino added a comment -

        Wicket Ajax Debug Outputs This
        An Error Message Shows

        eceived ajax response (457 characters)
        INFO:
        <?xml version="1.0" encoding="UTF-8"?><ajax-response><evaluate><![CDATA[var win;
        try

        { win = window.parent.Wicket.Window; }

        catch (ignore) {
        }
        if (typeof(win) == "undefined" || typeof(win.current) == "undefined") {
        try

        { win = window.Wicket.Window; }

        catch (ignore) {
        }
        }
        if (typeof(win) != "undefined" && typeof(win.current) != "undefined") {
        window.parent.setTimeout(function()

        { win.current.close(); }

        , 0);
        }]]></evaluate></ajax-response>
        INFO: Response parsed. Now invoking steps...
        ERROR: Exception evaluating javascript: TypeError: window.parent.setTimeout is not a function
        INFO: Response processed successfully.
        INFO: Invoking post-call handler(s)...
        INFO: Calling focus on back-button23
        INFO: focus set on back-button23
        INFO: focus set on

        Show
        Carlo M. Camerino added a comment - Wicket Ajax Debug Outputs This An Error Message Shows eceived ajax response (457 characters) INFO: <?xml version="1.0" encoding="UTF-8"?><ajax-response><evaluate><![CDATA[var win; try { win = window.parent.Wicket.Window; } catch (ignore) { } if (typeof(win) == "undefined" || typeof(win.current) == "undefined") { try { win = window.Wicket.Window; } catch (ignore) { } } if (typeof(win) != "undefined" && typeof(win.current) != "undefined") { window.parent.setTimeout(function() { win.current.close(); } , 0); }]]></evaluate></ajax-response> INFO: Response parsed. Now invoking steps... ERROR: Exception evaluating javascript: TypeError: window.parent.setTimeout is not a function INFO: Response processed successfully. INFO: Invoking post-call handler(s)... INFO: Calling focus on back-button23 INFO: focus set on back-button23 INFO: focus set on
        Hide
        Carlo M. Camerino added a comment -

        Still doesn't work with latest snapshot

        If I change the IndicatingAjaxButton to an AjaxLink it closes properly.

        public class ConfirmWindowPanel extends Panel {
        private ButtonCommand buttonCommand;

        public ButtonCommand getButtonCommand()

        { return buttonCommand; }

        public void setButtonCommand(ButtonCommand buttonCommand)

        { this.buttonCommand = buttonCommand; }

        public ConfirmWindowPanel(String id)

        { super(id); // TODO Auto-generated constructor stub add(new ConfirmWindowPanelForm(WicketConstants.WICKET_CONFIRM_FORM)); }

        class ConfirmWindowPanelForm extends Form {

        public ConfirmWindowPanelForm(String id) {
        super(id);
        // TODO Auto-generated constructor stub
        add(new IndicatingAjaxButton("back-button", this) {
        @Override
        public void onSubmit(AjaxRequestTarget target, Form form)

        { ModalWindow modalWindow = (ModalWindow) this.getParent().getParent().getParent(); modalWindow.close(target); }

        });
        add(new IndicatingAjaxButton("confirm-button", this) {

        @Override
        public void onSubmit(AjaxRequestTarget target, Form form ) {
        ModalWindow modalWindow = (ModalWindow) this.getParent().getParent().getParent();
        CommonBasePage commonBasePage = (CommonBasePage) this.getPage();
        target.addComponent(commonBasePage.getFeedback());
        try

        { buttonCommand.submit(); }

        catch(DataIntegrityViolationException e)

        { error("Unique constraint violated."); modalWindow.close(target); }

        catch(StaleObjectStateException e)

        { error("Row(s) was updated or deleted by another transaction."); modalWindow.close(target); } catch(VersionMismatchException e) { error("Row(s) was updated or deleted by another transaction."); modalWindow.close(target); }

        catch(CCTIException e)

        { error(e.getMessage()); modalWindow.close(target); }

        catch(RuntimeException e)

        { error("Application Error Occurred"); modalWindow.close(target); e.printStackTrace(); }catch(Exception e) { error("Application Error Occurred"); modalWindow.close(target); e.printStackTrace(); }

        }

        });
        }

        }
        }

        Show
        Carlo M. Camerino added a comment - Still doesn't work with latest snapshot If I change the IndicatingAjaxButton to an AjaxLink it closes properly. public class ConfirmWindowPanel extends Panel { private ButtonCommand buttonCommand; public ButtonCommand getButtonCommand() { return buttonCommand; } public void setButtonCommand(ButtonCommand buttonCommand) { this.buttonCommand = buttonCommand; } public ConfirmWindowPanel(String id) { super(id); // TODO Auto-generated constructor stub add(new ConfirmWindowPanelForm(WicketConstants.WICKET_CONFIRM_FORM)); } class ConfirmWindowPanelForm extends Form { public ConfirmWindowPanelForm(String id) { super(id); // TODO Auto-generated constructor stub add(new IndicatingAjaxButton("back-button", this) { @Override public void onSubmit(AjaxRequestTarget target, Form form) { ModalWindow modalWindow = (ModalWindow) this.getParent().getParent().getParent(); modalWindow.close(target); } }); add(new IndicatingAjaxButton("confirm-button", this) { @Override public void onSubmit(AjaxRequestTarget target, Form form ) { ModalWindow modalWindow = (ModalWindow) this.getParent().getParent().getParent(); CommonBasePage commonBasePage = (CommonBasePage) this.getPage(); target.addComponent(commonBasePage.getFeedback()); try { buttonCommand.submit(); } catch(DataIntegrityViolationException e) { error("Unique constraint violated."); modalWindow.close(target); } catch(StaleObjectStateException e) { error("Row(s) was updated or deleted by another transaction."); modalWindow.close(target); } catch(VersionMismatchException e) { error("Row(s) was updated or deleted by another transaction."); modalWindow.close(target); } catch(CCTIException e) { error(e.getMessage()); modalWindow.close(target); } catch(RuntimeException e) { error("Application Error Occurred"); modalWindow.close(target); e.printStackTrace(); }catch(Exception e) { error("Application Error Occurred"); modalWindow.close(target); e.printStackTrace(); } } }); } } }
        Hide
        Carlo M. Camerino added a comment -

        Modal Window

        Show
        Carlo M. Camerino added a comment - Modal Window
        Hide
        Matej Knopp added a comment -

        Should be fixed, can you please check if current trunk works for you?

        Show
        Matej Knopp added a comment - Should be fixed, can you please check if current trunk works for you?
        Hide
        Don Hass added a comment -

        I had the similar problem today after getting an updated snapshot.
        Modal Windows (panel based - not page) that I had with a form on it would fail to close throwing a JS exception.

        My investigation found that the update to wicket-ajax.js is the culprit. Revision 579593 to be specific.
        /jdk-1.4/wicket/src/main/java/org/apache/wicket/ajax/wicket-ajax.js (revision 579593)

        It appears the update on this morning at Sept 26 at 7:16AM by knopp broke this for me at least. Since if I went back to the previous revision (579172) the problem goes away.

        Specific code in question is listed below. Hope this helps save someone else some headaches this caused for me this morning. I guess that is what I get for using latest snapshots some times.

        • try { - // do the evaluation - eval(text); - }

          catch (exception)

          { - Wicket.Log.error("Exception evaluating javascript: " + exception); - }
        • // continue to next step
        • notify();
        • });
          +
          + // test if the javascript is in form of identifier|code
          + // if it is, we allow for letting the javascript decide when the rest of processing will continue
          + // by invoking identifier();
          + var res = text.match("([a-z|A-Z_][a-z|A-Z|0-9_])
          |(.
          )");
          +
          + if (res != null)
          Unknown macro: {+ text = "var f = function(" + res[1] + ") {" + res[2] +"};"; + try { + // do the evaluation + eval(text); + f(notify); + } catch (exception) { + Wicket.Log.error("Exception evaluating javascript: " + exception); + }+ + }

          else

          Unknown macro: {+ // just evaluate the javascript+ try { + // do the evaluation + eval(text); + } catch (exception) { + Wicket.Log.error("Exception evaluating javascript: " + exception); + }+ // continue to next step+ notify();+ }

          + });

        Show
        Don Hass added a comment - I had the similar problem today after getting an updated snapshot. Modal Windows (panel based - not page) that I had with a form on it would fail to close throwing a JS exception. My investigation found that the update to wicket-ajax.js is the culprit. Revision 579593 to be specific. /jdk-1.4/wicket/src/main/java/org/apache/wicket/ajax/wicket-ajax.js (revision 579593) It appears the update on this morning at Sept 26 at 7:16AM by knopp broke this for me at least. Since if I went back to the previous revision (579172) the problem goes away. Specific code in question is listed below. Hope this helps save someone else some headaches this caused for me this morning. I guess that is what I get for using latest snapshots some times. try { - // do the evaluation - eval(text); - } catch (exception) { - Wicket.Log.error("Exception evaluating javascript: " + exception); - } // continue to next step notify(); }); + + // test if the javascript is in form of identifier|code + // if it is, we allow for letting the javascript decide when the rest of processing will continue + // by invoking identifier(); + var res = text.match("( [a-z|A-Z_] [a-z|A-Z|0-9_] ) |(. )"); + + if (res != null) Unknown macro: {+ text = "var f = function(" + res[1] + ") {" + res[2] +"};"; + try { + // do the evaluation + eval(text); + f(notify); + } catch (exception) { + Wicket.Log.error("Exception evaluating javascript: " + exception); + }+ + } else Unknown macro: {+ // just evaluate the javascript+ try { + // do the evaluation + eval(text); + } catch (exception) { + Wicket.Log.error("Exception evaluating javascript: " + exception); + }+ // continue to next step+ notify();+ } + });
        Hide
        Russell Morrisey added a comment -

        I think I am having the same issue. I am using wicket-1.3.0-SNAPSHOT; if I remember correctly, it was built from SVN this morning by my co-worker (I'll check tomorrow morning and post again if this is incorrect). The ModalWindow closes fine using the "X" at the top right corner, but if ModalWindow#close(AjaxRequestTarget) is called, an error appears in the WICKET AJAX DEBUG log. I have attached a quickstart that demonstrates the problem.

        Show
        Russell Morrisey added a comment - I think I am having the same issue. I am using wicket-1.3.0-SNAPSHOT; if I remember correctly, it was built from SVN this morning by my co-worker (I'll check tomorrow morning and post again if this is incorrect). The ModalWindow closes fine using the "X" at the top right corner, but if ModalWindow#close(AjaxRequestTarget) is called, an error appears in the WICKET AJAX DEBUG log. I have attached a quickstart that demonstrates the problem.

          People

          • Assignee:
            Matej Knopp
            Reporter:
            Carlo M. Camerino
          • Votes:
            5 Vote for this issue
            Watchers:
            9 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development