You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Chris Colman <ch...@stepaheadsoftware.com> on 2010/09/15 07:41:11 UTC

Opening a modal form from another modal form causes "are you sure?"

>From a panel on a page I open modal form A. If I close this form via its
OK button it closes without issue.

However if I open modal form A then click "add item" on that form it
opens up yet another modal form (stacked form?) so the user can edit the
item. They click on form B's OK buttom and everything is fine ... until
the first form, Form A is closed again via its OK button. This time Form
A closes with the message:

"Are you sure you want to navigate away from this page?

Reloading this page will cause the modal window to disappear.

Press OK to continue, or Cancel to stay on the current page."

And then displays this error message/stack:

WicketMessage: Submit Button ok (path=body:modalWindow:content:form:ok)
is not visible

Root cause:

org.apache.wicket.WicketRuntimeException: Submit Button ok
(path=body:modalWindow:content:form:ok) is not visible
at org.apache.wicket.markup.html.form.Form$2.component(Form.java:622)
at
org.apache.wicket.MarkupContainer.visitChildren(MarkupContainer.java:899
)
at
org.apache.wicket.MarkupContainer.visitChildren(MarkupContainer.java:914
)
at
org.apache.wicket.MarkupContainer.visitChildren(MarkupContainer.java:914
)
at
org.apache.wicket.MarkupContainer.visitChildren(MarkupContainer.java:914
)
at
org.apache.wicket.MarkupContainer.visitChildren(MarkupContainer.java:914
)
at
org.apache.wicket.markup.html.form.Form.findSubmittingButton(Form.java:6
04)
at
org.apache.wicket.markup.html.form.Form.onFormSubmitted(Form.java:899)
at
org.apache.wicket.ajax.form.AjaxFormSubmitBehavior.onEvent(AjaxFormSubmi
tBehavior.java:135)
at
org.apache.wicket.ajax.AjaxEventBehavior.respond(AjaxEventBehavior.java:
177)
at
org.apache.wicket.ajax.AbstractDefaultAjaxBehavior.onRequest(AbstractDef
aultAjaxBehavior.java:300)
at
org.apache.wicket.request.target.component.listener.BehaviorRequestTarge
t.processEvents(BehaviorRequestTarget.java:119)
at
org.apache.wicket.request.AbstractRequestCycleProcessor.processEvents(Ab
stractRequestCycleProcessor.java:92)
at
org.apache.wicket.RequestCycle.processEventsAndRespond(RequestCycle.java
:1250)
at org.apache.wicket.RequestCycle.step(RequestCycle.java:1329)
at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1436)
at org.apache.wicket.RequestCycle.request(RequestCycle.java:545)
at
org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:484
)
at
org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:
317)
at
com.sas.av.ui.wicket.templates.original.PagebloomFilter.doFilter(Pageblo
omFilter.java:95)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Applica
tionFilterChain.java:235)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilt
erChain.java:206)
at
com.sas.framework.expojo.servlet.ExpojoServletFilter.doFilter(ExpojoServ
letFilter.java:201)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Applica
tionFilterChain.java:235)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilt
erChain.java:206)
at com.sas.util.web.StaticResponseHeaderFilter.doFilter(Unknown Source)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Applica
tionFilterChain.java:235)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilt
erChain.java:206)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValv
e.java:233)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValv
e.java:191)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java
:128)
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java
:102)
at
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:568
)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.
java:109)
at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:2
86)
at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:84
5)
at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(
Http11Protocol.java:583)
at
org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Thread.java:619)



All my modal windows use a single instance of ModalWindow that is
instantiated in the base page and reused for all modal windows -
hopefully that is ok.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


RE: Opening a modal form from another modal form causes "are you sure?"

Posted by Chris Colman <ch...@stepaheadsoftware.com>.
>you would have to rerender modal A i think, you need to reestablish
>the hierarchy on server-side
>
>-igor

That's not so bad - it's kind of what I need to do anyway, because form
A needs to be rerendered to update labels that are populated by model
objects created/edited in B.

Is it just a matter of 

remove(formA);
add(formA);

to do the rerender?

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


RE: Opening a modal form from another modal form causes "are you sure?"

Posted by Chris Colman <ch...@stepaheadsoftware.com>.
>you would have to rerender modal A i think, you need to reestablish
>the hierarchy on server-side

I've tried quite a few different methods for rerendering Modal A but
none of them work as required.

Is there a simple couple of lines that would do such a rerender of the
ModalWindow?

>
>-igor

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Opening a modal form from another modal form causes "are you sure?"

Posted by Igor Vaynberg <ig...@gmail.com>.
you would have to rerender modal A i think, you need to reestablish
the hierarchy on server-side

-igor

On Tue, Sep 14, 2010 at 11:01 PM, Chris Colman
<ch...@stepaheadsoftware.com> wrote:
>>> All my modal windows use a single instance of ModalWindow that is
>>> instantiated in the base page and reused for all modal windows -
>>> hopefully that is ok.
>>
>>no, thats the problem. when modal B shows it removes the panel that
>>was inside modal A out of component hieararchy. so when you click
>>submit on modal A after modal B has been opened that button is no
>>longer in the component hierarchy and thus the error.
>
> Doh! Reusing a single ModalWindow was my "genius" plan for a simple,
> reusable Modal Window architecture.
>
> Is there a way to 're-establish' modal A's ModalWindow in the hierarchy
> after Form B is closed? Apparently it's only not visible in Wicket's
> hierarchy - the form appears to still be in the DOM hierarchy because
> the form is still present in the browser.
>
> I have a modal close listener. Could I somehow reestablish Modal A in
> the wicket hierarchy when the listener callback is called?
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


RE: Opening a modal form from another modal form causes "are you sure?"

Posted by Chris Colman <ch...@stepaheadsoftware.com>.
>> All my modal windows use a single instance of ModalWindow that is
>> instantiated in the base page and reused for all modal windows -
>> hopefully that is ok.
>
>no, thats the problem. when modal B shows it removes the panel that
>was inside modal A out of component hieararchy. so when you click
>submit on modal A after modal B has been opened that button is no
>longer in the component hierarchy and thus the error.

Doh! Reusing a single ModalWindow was my "genius" plan for a simple,
reusable Modal Window architecture.

Is there a way to 're-establish' modal A's ModalWindow in the hierarchy
after Form B is closed? Apparently it's only not visible in Wicket's
hierarchy - the form appears to still be in the DOM hierarchy because
the form is still present in the browser. 

I have a modal close listener. Could I somehow reestablish Modal A in
the wicket hierarchy when the listener callback is called?


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Opening a modal form from another modal form causes "are you sure?"

Posted by Igor Vaynberg <ig...@gmail.com>.
On Tue, Sep 14, 2010 at 10:41 PM, Chris Colman
<ch...@stepaheadsoftware.com> wrote:
> From a panel on a page I open modal form A. If I close this form via its
> OK button it closes without issue.
>
> However if I open modal form A then click "add item" on that form it
> opens up yet another modal form (stacked form?) so the user can edit the
> item. They click on form B's OK buttom and everything is fine ... until
> the first form, Form A is closed again via its OK button. This time Form
> A closes with the message:
>
> "Are you sure you want to navigate away from this page?
>
> Reloading this page will cause the modal window to disappear.
>
> Press OK to continue, or Cancel to stay on the current page."
>
> And then displays this error message/stack:
>
> WicketMessage: Submit Button ok (path=body:modalWindow:content:form:ok)
> is not visible
>
> Root cause:
>
> org.apache.wicket.WicketRuntimeException: Submit Button ok
> (path=body:modalWindow:content:form:ok) is not visible
> at org.apache.wicket.markup.html.form.Form$2.component(Form.java:622)
> at
> org.apache.wicket.MarkupContainer.visitChildren(MarkupContainer.java:899
> )
> at
> org.apache.wicket.MarkupContainer.visitChildren(MarkupContainer.java:914
> )
> at
> org.apache.wicket.MarkupContainer.visitChildren(MarkupContainer.java:914
> )
> at
> org.apache.wicket.MarkupContainer.visitChildren(MarkupContainer.java:914
> )
> at
> org.apache.wicket.MarkupContainer.visitChildren(MarkupContainer.java:914
> )
> at
> org.apache.wicket.markup.html.form.Form.findSubmittingButton(Form.java:6
> 04)
> at
> org.apache.wicket.markup.html.form.Form.onFormSubmitted(Form.java:899)
> at
> org.apache.wicket.ajax.form.AjaxFormSubmitBehavior.onEvent(AjaxFormSubmi
> tBehavior.java:135)
> at
> org.apache.wicket.ajax.AjaxEventBehavior.respond(AjaxEventBehavior.java:
> 177)
> at
> org.apache.wicket.ajax.AbstractDefaultAjaxBehavior.onRequest(AbstractDef
> aultAjaxBehavior.java:300)
> at
> org.apache.wicket.request.target.component.listener.BehaviorRequestTarge
> t.processEvents(BehaviorRequestTarget.java:119)
> at
> org.apache.wicket.request.AbstractRequestCycleProcessor.processEvents(Ab
> stractRequestCycleProcessor.java:92)
> at
> org.apache.wicket.RequestCycle.processEventsAndRespond(RequestCycle.java
> :1250)
> at org.apache.wicket.RequestCycle.step(RequestCycle.java:1329)
> at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1436)
> at org.apache.wicket.RequestCycle.request(RequestCycle.java:545)
> at
> org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:484
> )
> at
> org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:
> 317)
> at
> com.sas.av.ui.wicket.templates.original.PagebloomFilter.doFilter(Pageblo
> omFilter.java:95)
> at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Applica
> tionFilterChain.java:235)
> at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilt
> erChain.java:206)
> at
> com.sas.framework.expojo.servlet.ExpojoServletFilter.doFilter(ExpojoServ
> letFilter.java:201)
> at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Applica
> tionFilterChain.java:235)
> at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilt
> erChain.java:206)
> at com.sas.util.web.StaticResponseHeaderFilter.doFilter(Unknown Source)
> at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Applica
> tionFilterChain.java:235)
> at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilt
> erChain.java:206)
> at
> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValv
> e.java:233)
> at
> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValv
> e.java:191)
> at
> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java
> :128)
> at
> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java
> :102)
> at
> org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:568
> )
> at
> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.
> java:109)
> at
> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:2
> 86)
> at
> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:84
> 5)
> at
> org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(
> Http11Protocol.java:583)
> at
> org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
> at java.lang.Thread.run(Thread.java:619)
>
>
>
> All my modal windows use a single instance of ModalWindow that is
> instantiated in the base page and reused for all modal windows -
> hopefully that is ok.

no, thats the problem. when modal B shows it removes the panel that
was inside modal A out of component hieararchy. so when you click
submit on modal A after modal B has been opened that button is no
longer in the component hierarchy and thus the error.

-igor
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org