You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@wicket.apache.org by Al Maw <wi...@almaw.com> on 2007/03/07 03:50:38 UTC

AjaxSubmitButton in Panel inside ModalWindow in a Form

AjaxSubmitButton in a ModalWindow using a Panel as content doesn't work 
if the ModalWindow component is itself embedded in a Form.

The issue is that ModalWindow tacks its content on as a <div> on the 
<body> element, which places it outside the original <form> element.

If we fix ModalWindow to inject its Panel content into the middle of the 
page where the component actually lies, then all the CSS is messed up - 
it uses position: absolute, which will work fine until you put the 
ModalWindow component inside something that is position: relative;

If you add a <form> to the ModalWindow's Panel, then the nested Form 
resolution stuff removes the <form> element because it thinks it has a 
parent <form>, even though when it's rendered it's actually outside it.

I'm not sure how to fix this, or even if it's possible to.
Maybe we can make the nested form hierarchy check stop traversing its 
parents at ModalWindow boundaries, and require than things inside a 
ModalWindow have their own Form?

Al

Re: AjaxSubmitButton in Panel inside ModalWindow in a Form

Posted by Matej Knopp <ma...@knopp.sk>.
Since I just backported nested forms from trunk, this works in 1.x :)
All you need to do is to place a form inside modal window if you want to 
submit it. Wicket should take care of the rest.

-Matej

Al Maw wrote:
> AjaxSubmitButton in a ModalWindow using a Panel as content doesn't work 
> if the ModalWindow component is itself embedded in a Form.
> 
> The issue is that ModalWindow tacks its content on as a <div> on the 
> <body> element, which places it outside the original <form> element.
> 
> If we fix ModalWindow to inject its Panel content into the middle of the 
> page where the component actually lies, then all the CSS is messed up - 
> it uses position: absolute, which will work fine until you put the 
> ModalWindow component inside something that is position: relative;
> 
> If you add a <form> to the ModalWindow's Panel, then the nested Form 
> resolution stuff removes the <form> element because it thinks it has a 
> parent <form>, even though when it's rendered it's actually outside it.
> 
> I'm not sure how to fix this, or even if it's possible to.
> Maybe we can make the nested form hierarchy check stop traversing its 
> parents at ModalWindow boundaries, and require than things inside a 
> ModalWindow have their own Form?
> 
> Al
>