You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Serzhas <Se...@exigenservices.com> on 2008/03/04 17:35:29 UTC

ModalWindow (component based) + form submit = can't close

Hi. I am complete newby to Wicket, and currently making my way through the
"forest" if Wicket API :) <br/>
Today I tryed to create a "proof-of-concept" for new Wicket component, and
found some strange behavior of ModalWindow that is based on component
(Panel), and put within <form> tag.
To put in short my page hierarchy looks like this:
DOCUMENT (HTML)
  FORM
    MODAL_WINDOW
       INNER_FORM (DIV)
          SOME_TEXT_FIELDS
          SUBMIT
When I just open ModalWindow (MW) and close it right away, it closes as
espected. But if I submit inner form prior to closing MW, it will stay open,
and there is no way to close it other than to reload entire page. However,
all events fires as espected, MW closing JavaScript runs (I added alert() to
it), and MW itself reports as isShown() == false. 
If I either remove top-most form, or use Page based MW instead of component
(just changing content class ancestor from Panel to WebPage and slightly
altering constructor by removing Id), everything works just fine. 
Any suggestions will follow? Thanks in advance.

-- 
View this message in context: http://www.nabble.com/ModalWindow-%28component-based%29-%2B-form-submit-%3D-can%27t-close-tp15831226p15831226.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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


Re: ModalWindow (component based) + form submit = can't close

Posted by Serzhas <Se...@exigenservices.com>.
Thanks Matej, but I have tryied many submit variants, AjaxSubmitButton was
one of them.
No matter what kind of submit I use, if form was submitted once, dialog
won't close...


Matej Knopp-2 wrote:
> 
> You have to use AjaxSubmitButton if you put panel into modal window.
> 
> -Matej
> 
> On Tue, Mar 18, 2008 at 12:16 PM, Kai Mütz <km...@googlemail.com> wrote:
>>
>>
>>
>>  Serzhas wrote:
>>  >
>>  > Hi. I am complete newby to Wicket, and currently making my way through
>> the
>>  > "forest" if Wicket API :) <br/>
>>  > Today I tryed to create a "proof-of-concept" for new Wicket component,
>> and
>>  > found some strange behavior of ModalWindow that is based on component
>>  > (Panel), and put within <form> tag.
>>  > To put in short my page hierarchy looks like this:
>>  > DOCUMENT (HTML)
>>  >   FORM
>>  >     MODAL_WINDOW
>>  >        INNER_FORM (DIV)
>>  >           SOME_TEXT_FIELDS
>>  >           SUBMIT
>>  > When I just open ModalWindow (MW) and close it right away, it closes
>> as
>>  > espected. But if I submit inner form prior to closing MW, it will stay
>>  > open, and there is no way to close it other than to reload entire
>> page.
>>  > However, all events fires as espected, MW closing JavaScript runs (I
>> added
>>  > alert() to it), and MW itself reports as isShown() == false.
>>  > If I either remove top-most form, or use Page based MW instead of
>>  > component (just changing content class ancestor from Panel to WebPage
>> and
>>  > slightly altering constructor by removing Id), everything works just
>> fine.
>>  > Any suggestions will follow? Thanks in advance.
>>  >
>>  >
>>
>>  I have the same problem. Do you have found a solution?
>>
>>  Kai
>>  --
>>  View this message in context:
>> http://www.nabble.com/ModalWindow-%28component-based%29-%2B-form-submit-%3D-can%27t-close-tp15831226p16118824.html
>>
>>
>> Sent from the Wicket - User mailing list archive at Nabble.com.
>>
>>
>>  ---------------------------------------------------------------------
>>  To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>  For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
> 
> 
> 
> -- 
> Resizable and reorderable grid components.
> http://www.inmethod.com
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/ModalWindow-%28component-based%29-%2B-form-submit-%3D-can%27t-close-tp15831226p16119608.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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


Re: ModalWindow (component based) + form submit = can't close

Posted by Serzhas <Se...@exigenservices.com>.
I wrote about Pages in ModalWindow in my initial post :) This is the solution
I currently using.
But creation and popup of such ModalWindow is slower, than a Panel-based
one. However, I also
noticed, that with Page as content of ModalWindow dialog content is added to
DOM only when
it is opened, and removed when it's closed. With Panel-based ModalWindow
markup stays in DOM 
all the time after first open (until page reloaded). Not sure, but this may
be an undesired behavior in 
some cases.


Mr Mean wrote:
> 
> We use forms in our modal windows without problems.
> We do use Pages instead of panels and the form is submitted with an
> AjaxSubmitLink. Also the form is a FilterForm found in
> wicket-extensions but i don't think that should make a difference.
> 
> Maybe this information is of some help to you.
> 
> Maurice
> 
> On Tue, Mar 18, 2008 at 1:07 PM, Kai Mütz <km...@googlemail.com> wrote:
>> Matej Knopp schrieb:
>>
>> > You have to use AjaxSubmitButton if you put panel into modal window.
>>  >
>>
>>  No difference. I have tried AjaxSubmitButton, AjaxButton and
>>  AjaxSubmitLink. Once I have submitted the form, the modal window stays
>>  open. Reload of the entire page necessary to close modal.
>>
>>  Is there a working example of getting form input within a modal window?
>>
>>  Thanks, Kai
>>
>>
>>
>>  ---------------------------------------------------------------------
>>  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
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/ModalWindow-%28component-based%29-%2B-form-submit-%3D-can%27t-close-tp15831226p16120597.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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


Re: ModalWindow (component based) + form submit = can't close

Posted by Maurice Marrink <ma...@gmail.com>.
We use forms in our modal windows without problems.
We do use Pages instead of panels and the form is submitted with an
AjaxSubmitLink. Also the form is a FilterForm found in
wicket-extensions but i don't think that should make a difference.

Maybe this information is of some help to you.

Maurice

On Tue, Mar 18, 2008 at 1:07 PM, Kai Mütz <km...@googlemail.com> wrote:
> Matej Knopp schrieb:
>
> > You have to use AjaxSubmitButton if you put panel into modal window.
>  >
>
>  No difference. I have tried AjaxSubmitButton, AjaxButton and
>  AjaxSubmitLink. Once I have submitted the form, the modal window stays
>  open. Reload of the entire page necessary to close modal.
>
>  Is there a working example of getting form input within a modal window?
>
>  Thanks, Kai
>
>
>
>  ---------------------------------------------------------------------
>  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: ModalWindow (component based) + form submit = can't close

Posted by Kai Mütz <km...@googlemail.com>.
Matej Knopp schrieb:
> You have to use AjaxSubmitButton if you put panel into modal window.
> 

No difference. I have tried AjaxSubmitButton, AjaxButton and 
AjaxSubmitLink. Once I have submitted the form, the modal window stays 
open. Reload of the entire page necessary to close modal.

Is there a working example of getting form input within a modal window?

Thanks, Kai

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


Re: ModalWindow (component based) + form submit = can't close

Posted by Matej Knopp <ma...@gmail.com>.
You have to use AjaxSubmitButton if you put panel into modal window.

-Matej

On Tue, Mar 18, 2008 at 12:16 PM, Kai Mütz <km...@googlemail.com> wrote:
>
>
>
>  Serzhas wrote:
>  >
>  > Hi. I am complete newby to Wicket, and currently making my way through the
>  > "forest" if Wicket API :) <br/>
>  > Today I tryed to create a "proof-of-concept" for new Wicket component, and
>  > found some strange behavior of ModalWindow that is based on component
>  > (Panel), and put within <form> tag.
>  > To put in short my page hierarchy looks like this:
>  > DOCUMENT (HTML)
>  >   FORM
>  >     MODAL_WINDOW
>  >        INNER_FORM (DIV)
>  >           SOME_TEXT_FIELDS
>  >           SUBMIT
>  > When I just open ModalWindow (MW) and close it right away, it closes as
>  > espected. But if I submit inner form prior to closing MW, it will stay
>  > open, and there is no way to close it other than to reload entire page.
>  > However, all events fires as espected, MW closing JavaScript runs (I added
>  > alert() to it), and MW itself reports as isShown() == false.
>  > If I either remove top-most form, or use Page based MW instead of
>  > component (just changing content class ancestor from Panel to WebPage and
>  > slightly altering constructor by removing Id), everything works just fine.
>  > Any suggestions will follow? Thanks in advance.
>  >
>  >
>
>  I have the same problem. Do you have found a solution?
>
>  Kai
>  --
>  View this message in context: http://www.nabble.com/ModalWindow-%28component-based%29-%2B-form-submit-%3D-can%27t-close-tp15831226p16118824.html
>
>
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
>  ---------------------------------------------------------------------
>  To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>  For additional commands, e-mail: users-help@wicket.apache.org
>
>



-- 
Resizable and reorderable grid components.
http://www.inmethod.com

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


Re: ModalWindow (component based) + form submit = can't close

Posted by Kai Mütz <km...@googlemail.com>.


Serzhas wrote:
> 
> Hi. I am complete newby to Wicket, and currently making my way through the
> "forest" if Wicket API :) <br/>
> Today I tryed to create a "proof-of-concept" for new Wicket component, and
> found some strange behavior of ModalWindow that is based on component
> (Panel), and put within <form> tag.
> To put in short my page hierarchy looks like this:
> DOCUMENT (HTML)
>   FORM
>     MODAL_WINDOW
>        INNER_FORM (DIV)
>           SOME_TEXT_FIELDS
>           SUBMIT
> When I just open ModalWindow (MW) and close it right away, it closes as
> espected. But if I submit inner form prior to closing MW, it will stay
> open, and there is no way to close it other than to reload entire page.
> However, all events fires as espected, MW closing JavaScript runs (I added
> alert() to it), and MW itself reports as isShown() == false. 
> If I either remove top-most form, or use Page based MW instead of
> component (just changing content class ancestor from Panel to WebPage and
> slightly altering constructor by removing Id), everything works just fine. 
> Any suggestions will follow? Thanks in advance.
> 
> 

I have the same problem. Do you have found a solution?

Kai
-- 
View this message in context: http://www.nabble.com/ModalWindow-%28component-based%29-%2B-form-submit-%3D-can%27t-close-tp15831226p16118824.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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


Re: ModalWindow (component based) + form submit = can't close

Posted by SantiagoA <s....@gmx.de>.
On the site that holds the ModalWindow I have something like that:

modalWindow.setContent(new modalWindowPanel(modalWindow.getContentId(), new
ModalWindow.CloseButtonCallback(){
	private static final long serialVersionUID = 4622180781771170962L;

	public boolean onCloseButtonClicked(AjaxRequestTarget target) {
		modalWindow.close(target);
		return true;
	}
			
}));

And in the Panel that is shown in the ModalWindows I do:

form.add(new AjaxButton("ok"){
  private static final long serialVersionUID = -5005868829551738938L;
  @Override
  protected void onSubmit(AjaxRequestTarget ajaxRequestTarget, Form form) {
    ajaxRequestTarget.addComponent(this.getPage().get("Formname"));
    // this.getPage() gives the Page which holds the ModalWindow
    closeCallback.onCloseButtonClicked(ajaxRequestTarget);
  }
});

Works fine for me, hope that helps.
-- 
View this message in context: http://www.nabble.com/ModalWindow-%28component-based%29-%2B-form-submit-%3D-can%27t-close-tp15831226p16121382.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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