You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Anthony J Webster <aw...@tentelemed.com> on 2007/09/13 12:14:05 UTC

Modal dialogs with Ajax

Hello again,

I have a form with ajax validation on its component's 'onblur' and a sumit link. The submission process takes a while as it results in numerous database lookups and so on. Initially I used an IndicatingAjaxSubmitButton to show the user that their request was being processed, with the help of mailinglist and #wicket members I also disabled the link during the submission with an AjaxCallDecorator and I suppose I could always add a modal div over the whole site as well (in the same callDecorator) in order to stop users changing the form contents or navigating to another part of the site.

That all works fine however I need to push this further. If a user submits information which corresponds to a object that already exists in the database, I need to ask him whether he wishes to create a duplicate.

The way I see this working is as follows. The user submits a valid form by clicking the link. This results in a modal centered dialog with some loading animation being displayed. If the submission works the user is redirected to a 'success' page where the entered data is display along with any information calculated during the submission. However if there is an error (an Exception thrown from the server) either a connection problem or duplicate data, the animation is replaced by some text explaining the problem and 1 or 2 buttons (Cancel for connection problems and Make Duplicate/Cancel for duplicate data). The Cancel button simply removes the modal window effectively returning the user to the form, whereas the Duplicate button launches the submission again and displays the animation until it succeeds or fails again in the case of connectivity problems.

I know this a lot to ask but has anyone got any idea how to achieve this as I'm getting a tad confused!

Many Thanks

Anthony

Re: ModalWindow bug - unable to close when added AjaxButton in content of the window

Posted by Thies Edeling <th...@rrm.net>.
never mind, seems it's the same as 
https://issues.apache.org/jira/browse/WICKET-1003

Thies Edeling wrote:
> Was there any resolution for this? I have the same thing with rc2 with a
> valid form. From the javascript console:
>
> *INFO: *
> Initiating Ajax POST request on ../../?wicket:interface=:4:39:::0:2&random=
> 0.745044540904514
> *INFO: *Invoking pre-call handler(s)...
> *INFO: *Received 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
>
>
> On Sep 20, 2007 9:58 AM, Vit Rozkovec <wi...@rozkovec.info> wrote:
>
>   
>> Yes, the form validates, I put the breakpoint at onSubmit and that
>> method was invoked.
>> I tried it also with empty form.
>> The behavior is following:
>> when I have only AjaxLinks in the form, it is ok.
>> When I add AjaxButton, the behavior changes - the first time the modal
>> window is displayed, it is possible to close the window with the cross
>> in the upper right corner and with any AjaxLink I have in the form. But
>> only when the first click goes to one of these elements.
>> When I first click on the button to close the window, suddently the
>> cross and the links became dead too.
>>
>> Vitek
>>
>> Matej Knopp wrote:
>>     
>>> Are you sure your Form validates, when you click AjaxLink? Because
>>> otherwise the onSubmit is not invoked. Can you put a breakpoint in
>>> onSubmit? Also there is onError handler that is invoked when form
>>> validation fails.
>>>
>>> -Matej
>>>
>>> On 9/14/07, Vit Rozkovec <wi...@rozkovec.info> wrote:
>>>
>>>       
>>>> I am sorry, I could not replicate it in quickstart. The button works
>>>> fine there. For now I solved the problem by replacing AjaxButtons with
>>>> AjaxLinks.
>>>>
>>>> Vitek
>>>>
>>>> Matej Knopp wrote:
>>>>
>>>>         
>>>>> Plase create a jira issue and attach a quickstart to it. Thanks.
>>>>>
>>>>> -Matej
>>>>>
>>>>> On 9/13/07, Vit Rozkovec <wi...@rozkovec.info> wrote:
>>>>>
>>>>>
>>>>>           
>>>>>> Good day,
>>>>>> I am using last snapshot of wicket and there is a problem with modal
>>>>>> window - I create instance of the window and add it to the page. As a
>>>>>> content I use a panel which has these components:
>>>>>>
>>>>>> public class ModalConfirmationPanel extends Panel {
>>>>>>
>>>>>>     public ModalConfirmationPanel(String id, final ModalWindow
>>>>>>             
>> window) {
>>     
>>>>>>         super(id);
>>>>>>
>>>>>>         window.setTitle(getString("titulek"));
>>>>>>
>>>>>>         Form form = new Form("confirmation");
>>>>>>         add(form);
>>>>>>         form.add(new TextArea("explanation", new Model("")));
>>>>>>         form.add(new AjaxLink("ok") {
>>>>>>             @Override
>>>>>>             public void onClick(AjaxRequestTarget target) {
>>>>>>                 window.close(target);
>>>>>>             }
>>>>>>         });
>>>>>>         form.add(new AjaxLink("storno") {
>>>>>>             @Override
>>>>>>             public void onClick(AjaxRequestTarget target) {
>>>>>>                 window.close(target);
>>>>>>             }
>>>>>>         });
>>>>>> //        form.add(new AjaxSubmitButton("buttonOk", form) {
>>>>>> //            @Override
>>>>>> //            protected void onSubmit(AjaxRequestTarget target, Form
>>>>>>             
>> form) {
>>     
>>>>>> //                window.close(target);
>>>>>> //            }
>>>>>> //        });
>>>>>> //        form.add(new AjaxButton("buttonStorno", form) {
>>>>>> //            @Override
>>>>>> //            protected void onSubmit(AjaxRequestTarget target, Form
>>>>>>             
>> form) {
>>     
>>>>>> //                window.close(target);
>>>>>> //            }
>>>>>> //        });
>>>>>>
>>>>>>
>>>>>> When I uncomment the lines and add AjaxSubmitButtons or AjaxButtons,
>>>>>>             
>> the
>>     
>>>>>> modal window cannot be closed anymore, neither with the buttons, nor
>>>>>> with the close button in the header or with links. When I add just
>>>>>> links, it works ok. It does not matter if there is window.close()
>>>>>>             
>> method
>>     
>>>>>> in the button's onSubmit method.
>>>>>>
>>>>>> If you would like I can make a quickstart. I cannot test anymore, but
>>>>>>             
>> in
>>     
>>>>>> beta3 it worked.
>>>>>>
>>>>>> Vitek
>>>>>>
>>>>>> ---------------------------------------------------------------------
>>>>>> 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
>>>>>
>>>>>
>>>>>
>>>>>           
>>>> ---------------------------------------------------------------------
>>>> 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
>>>
>>>
>>>       
>>     
>
>   


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


Re: ModalWindow bug - unable to close when added AjaxButton in content of the window

Posted by Thies Edeling <te...@gmail.com>.
Was there any resolution for this? I have the same thing with rc2 with a
valid form. From the javascript console:

*INFO: *
Initiating Ajax POST request on ../../?wicket:interface=:4:39:::0:2&random=
0.745044540904514
*INFO: *Invoking pre-call handler(s)...
*INFO: *Received 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


On Sep 20, 2007 9:58 AM, Vit Rozkovec <wi...@rozkovec.info> wrote:

> Yes, the form validates, I put the breakpoint at onSubmit and that
> method was invoked.
> I tried it also with empty form.
> The behavior is following:
> when I have only AjaxLinks in the form, it is ok.
> When I add AjaxButton, the behavior changes - the first time the modal
> window is displayed, it is possible to close the window with the cross
> in the upper right corner and with any AjaxLink I have in the form. But
> only when the first click goes to one of these elements.
> When I first click on the button to close the window, suddently the
> cross and the links became dead too.
>
> Vitek
>
> Matej Knopp wrote:
> > Are you sure your Form validates, when you click AjaxLink? Because
> > otherwise the onSubmit is not invoked. Can you put a breakpoint in
> > onSubmit? Also there is onError handler that is invoked when form
> > validation fails.
> >
> > -Matej
> >
> > On 9/14/07, Vit Rozkovec <wi...@rozkovec.info> wrote:
> >
> >> I am sorry, I could not replicate it in quickstart. The button works
> >> fine there. For now I solved the problem by replacing AjaxButtons with
> >> AjaxLinks.
> >>
> >> Vitek
> >>
> >> Matej Knopp wrote:
> >>
> >>> Plase create a jira issue and attach a quickstart to it. Thanks.
> >>>
> >>> -Matej
> >>>
> >>> On 9/13/07, Vit Rozkovec <wi...@rozkovec.info> wrote:
> >>>
> >>>
> >>>> Good day,
> >>>> I am using last snapshot of wicket and there is a problem with modal
> >>>> window - I create instance of the window and add it to the page. As a
> >>>> content I use a panel which has these components:
> >>>>
> >>>> public class ModalConfirmationPanel extends Panel {
> >>>>
> >>>>     public ModalConfirmationPanel(String id, final ModalWindow
> window) {
> >>>>         super(id);
> >>>>
> >>>>         window.setTitle(getString("titulek"));
> >>>>
> >>>>         Form form = new Form("confirmation");
> >>>>         add(form);
> >>>>         form.add(new TextArea("explanation", new Model("")));
> >>>>         form.add(new AjaxLink("ok") {
> >>>>             @Override
> >>>>             public void onClick(AjaxRequestTarget target) {
> >>>>                 window.close(target);
> >>>>             }
> >>>>         });
> >>>>         form.add(new AjaxLink("storno") {
> >>>>             @Override
> >>>>             public void onClick(AjaxRequestTarget target) {
> >>>>                 window.close(target);
> >>>>             }
> >>>>         });
> >>>> //        form.add(new AjaxSubmitButton("buttonOk", form) {
> >>>> //            @Override
> >>>> //            protected void onSubmit(AjaxRequestTarget target, Form
> form) {
> >>>> //                window.close(target);
> >>>> //            }
> >>>> //        });
> >>>> //        form.add(new AjaxButton("buttonStorno", form) {
> >>>> //            @Override
> >>>> //            protected void onSubmit(AjaxRequestTarget target, Form
> form) {
> >>>> //                window.close(target);
> >>>> //            }
> >>>> //        });
> >>>>
> >>>>
> >>>> When I uncomment the lines and add AjaxSubmitButtons or AjaxButtons,
> the
> >>>> modal window cannot be closed anymore, neither with the buttons, nor
> >>>> with the close button in the header or with links. When I add just
> >>>> links, it works ok. It does not matter if there is window.close()
> method
> >>>> in the button's onSubmit method.
> >>>>
> >>>> If you would like I can make a quickstart. I cannot test anymore, but
> in
> >>>> beta3 it worked.
> >>>>
> >>>> Vitek
> >>>>
> >>>> ---------------------------------------------------------------------
> >>>> 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
> >>>
> >>>
> >>>
> >> ---------------------------------------------------------------------
> >> 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 bug - unable to close when added AjaxButton in content of the window

Posted by Vit Rozkovec <wi...@rozkovec.info>.
Yes, the form validates, I put the breakpoint at onSubmit and that 
method was invoked.
I tried it also with empty form.
The behavior is following:
when I have only AjaxLinks in the form, it is ok.
When I add AjaxButton, the behavior changes - the first time the modal 
window is displayed, it is possible to close the window with the cross 
in the upper right corner and with any AjaxLink I have in the form. But 
only when the first click goes to one of these elements.
When I first click on the button to close the window, suddently the 
cross and the links became dead too.

Vitek

Matej Knopp wrote:
> Are you sure your Form validates, when you click AjaxLink? Because
> otherwise the onSubmit is not invoked. Can you put a breakpoint in
> onSubmit? Also there is onError handler that is invoked when form
> validation fails.
>
> -Matej
>
> On 9/14/07, Vit Rozkovec <wi...@rozkovec.info> wrote:
>   
>> I am sorry, I could not replicate it in quickstart. The button works
>> fine there. For now I solved the problem by replacing AjaxButtons with
>> AjaxLinks.
>>
>> Vitek
>>
>> Matej Knopp wrote:
>>     
>>> Plase create a jira issue and attach a quickstart to it. Thanks.
>>>
>>> -Matej
>>>
>>> On 9/13/07, Vit Rozkovec <wi...@rozkovec.info> wrote:
>>>
>>>       
>>>> Good day,
>>>> I am using last snapshot of wicket and there is a problem with modal
>>>> window - I create instance of the window and add it to the page. As a
>>>> content I use a panel which has these components:
>>>>
>>>> public class ModalConfirmationPanel extends Panel {
>>>>
>>>>     public ModalConfirmationPanel(String id, final ModalWindow window) {
>>>>         super(id);
>>>>
>>>>         window.setTitle(getString("titulek"));
>>>>
>>>>         Form form = new Form("confirmation");
>>>>         add(form);
>>>>         form.add(new TextArea("explanation", new Model("")));
>>>>         form.add(new AjaxLink("ok") {
>>>>             @Override
>>>>             public void onClick(AjaxRequestTarget target) {
>>>>                 window.close(target);
>>>>             }
>>>>         });
>>>>         form.add(new AjaxLink("storno") {
>>>>             @Override
>>>>             public void onClick(AjaxRequestTarget target) {
>>>>                 window.close(target);
>>>>             }
>>>>         });
>>>> //        form.add(new AjaxSubmitButton("buttonOk", form) {
>>>> //            @Override
>>>> //            protected void onSubmit(AjaxRequestTarget target, Form form) {
>>>> //                window.close(target);
>>>> //            }
>>>> //        });
>>>> //        form.add(new AjaxButton("buttonStorno", form) {
>>>> //            @Override
>>>> //            protected void onSubmit(AjaxRequestTarget target, Form form) {
>>>> //                window.close(target);
>>>> //            }
>>>> //        });
>>>>
>>>>
>>>> When I uncomment the lines and add AjaxSubmitButtons or AjaxButtons, the
>>>> modal window cannot be closed anymore, neither with the buttons, nor
>>>> with the close button in the header or with links. When I add just
>>>> links, it works ok. It does not matter if there is window.close() method
>>>> in the button's onSubmit method.
>>>>
>>>> If you would like I can make a quickstart. I cannot test anymore, but in
>>>> beta3 it worked.
>>>>
>>>> Vitek
>>>>
>>>> ---------------------------------------------------------------------
>>>> 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
>>>
>>>
>>>       
>> ---------------------------------------------------------------------
>> 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 bug - unable to close when added AjaxButton in content of the window

Posted by Matej Knopp <ma...@gmail.com>.
Are you sure your Form validates, when you click AjaxLink? Because
otherwise the onSubmit is not invoked. Can you put a breakpoint in
onSubmit? Also there is onError handler that is invoked when form
validation fails.

-Matej

On 9/14/07, Vit Rozkovec <wi...@rozkovec.info> wrote:
> I am sorry, I could not replicate it in quickstart. The button works
> fine there. For now I solved the problem by replacing AjaxButtons with
> AjaxLinks.
>
> Vitek
>
> Matej Knopp wrote:
> > Plase create a jira issue and attach a quickstart to it. Thanks.
> >
> > -Matej
> >
> > On 9/13/07, Vit Rozkovec <wi...@rozkovec.info> wrote:
> >
> >> Good day,
> >> I am using last snapshot of wicket and there is a problem with modal
> >> window - I create instance of the window and add it to the page. As a
> >> content I use a panel which has these components:
> >>
> >> public class ModalConfirmationPanel extends Panel {
> >>
> >>     public ModalConfirmationPanel(String id, final ModalWindow window) {
> >>         super(id);
> >>
> >>         window.setTitle(getString("titulek"));
> >>
> >>         Form form = new Form("confirmation");
> >>         add(form);
> >>         form.add(new TextArea("explanation", new Model("")));
> >>         form.add(new AjaxLink("ok") {
> >>             @Override
> >>             public void onClick(AjaxRequestTarget target) {
> >>                 window.close(target);
> >>             }
> >>         });
> >>         form.add(new AjaxLink("storno") {
> >>             @Override
> >>             public void onClick(AjaxRequestTarget target) {
> >>                 window.close(target);
> >>             }
> >>         });
> >> //        form.add(new AjaxSubmitButton("buttonOk", form) {
> >> //            @Override
> >> //            protected void onSubmit(AjaxRequestTarget target, Form form) {
> >> //                window.close(target);
> >> //            }
> >> //        });
> >> //        form.add(new AjaxButton("buttonStorno", form) {
> >> //            @Override
> >> //            protected void onSubmit(AjaxRequestTarget target, Form form) {
> >> //                window.close(target);
> >> //            }
> >> //        });
> >>
> >>
> >> When I uncomment the lines and add AjaxSubmitButtons or AjaxButtons, the
> >> modal window cannot be closed anymore, neither with the buttons, nor
> >> with the close button in the header or with links. When I add just
> >> links, it works ok. It does not matter if there is window.close() method
> >> in the button's onSubmit method.
> >>
> >> If you would like I can make a quickstart. I cannot test anymore, but in
> >> beta3 it worked.
> >>
> >> Vitek
> >>
> >> ---------------------------------------------------------------------
> >> 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
> >
> >
>
>
> ---------------------------------------------------------------------
> 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 bug - unable to close when added AjaxButton in content of the window

Posted by Vit Rozkovec <wi...@rozkovec.info>.
I am sorry, I could not replicate it in quickstart. The button works 
fine there. For now I solved the problem by replacing AjaxButtons with 
AjaxLinks.

Vitek

Matej Knopp wrote:
> Plase create a jira issue and attach a quickstart to it. Thanks.
>
> -Matej
>
> On 9/13/07, Vit Rozkovec <wi...@rozkovec.info> wrote:
>   
>> Good day,
>> I am using last snapshot of wicket and there is a problem with modal
>> window - I create instance of the window and add it to the page. As a
>> content I use a panel which has these components:
>>
>> public class ModalConfirmationPanel extends Panel {
>>
>>     public ModalConfirmationPanel(String id, final ModalWindow window) {
>>         super(id);
>>
>>         window.setTitle(getString("titulek"));
>>
>>         Form form = new Form("confirmation");
>>         add(form);
>>         form.add(new TextArea("explanation", new Model("")));
>>         form.add(new AjaxLink("ok") {
>>             @Override
>>             public void onClick(AjaxRequestTarget target) {
>>                 window.close(target);
>>             }
>>         });
>>         form.add(new AjaxLink("storno") {
>>             @Override
>>             public void onClick(AjaxRequestTarget target) {
>>                 window.close(target);
>>             }
>>         });
>> //        form.add(new AjaxSubmitButton("buttonOk", form) {
>> //            @Override
>> //            protected void onSubmit(AjaxRequestTarget target, Form form) {
>> //                window.close(target);
>> //            }
>> //        });
>> //        form.add(new AjaxButton("buttonStorno", form) {
>> //            @Override
>> //            protected void onSubmit(AjaxRequestTarget target, Form form) {
>> //                window.close(target);
>> //            }
>> //        });
>>
>>
>> When I uncomment the lines and add AjaxSubmitButtons or AjaxButtons, the
>> modal window cannot be closed anymore, neither with the buttons, nor
>> with the close button in the header or with links. When I add just
>> links, it works ok. It does not matter if there is window.close() method
>> in the button's onSubmit method.
>>
>> If you would like I can make a quickstart. I cannot test anymore, but in
>> beta3 it worked.
>>
>> Vitek
>>
>> ---------------------------------------------------------------------
>> 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
>
>   


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


Re: ModalWindow bug - unable to close when added AjaxButton in content of the window

Posted by Matej Knopp <ma...@gmail.com>.
Plase create a jira issue and attach a quickstart to it. Thanks.

-Matej

On 9/13/07, Vit Rozkovec <wi...@rozkovec.info> wrote:
> Good day,
> I am using last snapshot of wicket and there is a problem with modal
> window - I create instance of the window and add it to the page. As a
> content I use a panel which has these components:
>
> public class ModalConfirmationPanel extends Panel {
>
>     public ModalConfirmationPanel(String id, final ModalWindow window) {
>         super(id);
>
>         window.setTitle(getString("titulek"));
>
>         Form form = new Form("confirmation");
>         add(form);
>         form.add(new TextArea("explanation", new Model("")));
>         form.add(new AjaxLink("ok") {
>             @Override
>             public void onClick(AjaxRequestTarget target) {
>                 window.close(target);
>             }
>         });
>         form.add(new AjaxLink("storno") {
>             @Override
>             public void onClick(AjaxRequestTarget target) {
>                 window.close(target);
>             }
>         });
> //        form.add(new AjaxSubmitButton("buttonOk", form) {
> //            @Override
> //            protected void onSubmit(AjaxRequestTarget target, Form form) {
> //                window.close(target);
> //            }
> //        });
> //        form.add(new AjaxButton("buttonStorno", form) {
> //            @Override
> //            protected void onSubmit(AjaxRequestTarget target, Form form) {
> //                window.close(target);
> //            }
> //        });
>
>
> When I uncomment the lines and add AjaxSubmitButtons or AjaxButtons, the
> modal window cannot be closed anymore, neither with the buttons, nor
> with the close button in the header or with links. When I add just
> links, it works ok. It does not matter if there is window.close() method
> in the button's onSubmit method.
>
> If you would like I can make a quickstart. I cannot test anymore, but in
> beta3 it worked.
>
> Vitek
>
> ---------------------------------------------------------------------
> 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


ModalWindow bug - unable to close when added AjaxButton in content of the window

Posted by Vit Rozkovec <wi...@rozkovec.info>.
Good day,
I am using last snapshot of wicket and there is a problem with modal 
window - I create instance of the window and add it to the page. As a 
content I use a panel which has these components:

public class ModalConfirmationPanel extends Panel {

    public ModalConfirmationPanel(String id, final ModalWindow window) {
        super(id);
       
        window.setTitle(getString("titulek"));
       
        Form form = new Form("confirmation");
        add(form);
        form.add(new TextArea("explanation", new Model("")));
        form.add(new AjaxLink("ok") {
            @Override
            public void onClick(AjaxRequestTarget target) {
                window.close(target);   
            }
        });
        form.add(new AjaxLink("storno") {
            @Override
            public void onClick(AjaxRequestTarget target) {
                window.close(target);   
            }
        });
//        form.add(new AjaxSubmitButton("buttonOk", form) {
//            @Override
//            protected void onSubmit(AjaxRequestTarget target, Form form) {
//                window.close(target);
//            }
//        });
//        form.add(new AjaxButton("buttonStorno", form) {
//            @Override
//            protected void onSubmit(AjaxRequestTarget target, Form form) {
//                window.close(target);
//            }
//        });


When I uncomment the lines and add AjaxSubmitButtons or AjaxButtons, the 
modal window cannot be closed anymore, neither with the buttons, nor 
with the close button in the header or with links. When I add just 
links, it works ok. It does not matter if there is window.close() method 
in the button's onSubmit method.

If you would like I can make a quickstart. I cannot test anymore, but in 
beta3 it worked.

Vitek

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


Re: Modal dialogs with Ajax

Posted by Matej Knopp <ma...@gmail.com>.
Well, modal window is a bit overkill in this case. I guess I'd replace
it by a custom mask and probably a centered message with a button.
It's hard to be any detailed, as this requires some CSS work and
custom javascript.

-Matej

On 9/13/07, Anthony J Webster <aw...@tentelemed.com> wrote:
> Hello again,
>
> I have a form with ajax validation on its component's 'onblur' and a sumit link. The submission process takes a while as it results in numerous database lookups and so on. Initially I used an IndicatingAjaxSubmitButton to show the user that their request was being processed, with the help of mailinglist and #wicket members I also disabled the link during the submission with an AjaxCallDecorator and I suppose I could always add a modal div over the whole site as well (in the same callDecorator) in order to stop users changing the form contents or navigating to another part of the site.
>
> That all works fine however I need to push this further. If a user submits information which corresponds to a object that already exists in the database, I need to ask him whether he wishes to create a duplicate.
>
> The way I see this working is as follows. The user submits a valid form by clicking the link. This results in a modal centered dialog with some loading animation being displayed. If the submission works the user is redirected to a 'success' page where the entered data is display along with any information calculated during the submission. However if there is an error (an Exception thrown from the server) either a connection problem or duplicate data, the animation is replaced by some text explaining the problem and 1 or 2 buttons (Cancel for connection problems and Make Duplicate/Cancel for duplicate data). The Cancel button simply removes the modal window effectively returning the user to the form, whereas the Duplicate button launches the submission again and displays the animation until it succeeds or fails again in the case of connectivity problems.
>
> I know this a lot to ask but has anyone got any idea how to achieve this as I'm getting a tad confused!
>
> Many Thanks
>
> Anthony

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