I tried replacing the original SubmitLink in the form with an
AjaxSubmitLink:
public class AdvancedSearchForm extends Form {
private static final String id = "advanedSearchFrom";
public AdvancedSearchForm(IModel model) {
super(id, model);
add(new TextField("name"));
add(new TextField("user"));
// old code:
// add(new SubmitLink("submitSearch"));
add(new AjaxSubmitLink("submitSearch",AdvancedSearchForm.this){
@Override
protected void onSubmit(AjaxRequestTarget target, Form form) {
ModalWindow.close(target);
}});
}
}
However the modal window did not open and the following errors were
displayed:
Firefox Error console:
----------------------------
Error: no element found
Source File:
http://nilia/provision?wicket:interface=:9:simpleSearchPanel:advancedSearch::IBehaviorListener&wicket:behaviorId=0&random=0.6456663530703572
Line: 1, Column: 54
Source Code:
<?xml version="1.0"
encoding="UTF-8"?><ajax-response>-----------------------------------------------------^
Error: no element found
Source File:
http://nilia/provision/plugins/request-provision/ProvisioningRequests
Line: 1, Column: 54
Source Code:
<?xml version="1.0"
encoding="UTF-8"?><ajax-response>-----------------------------------------------------^
Wicket Ajax Debug window:
-------------------------------------
<?xml version="1.0" encoding="UTF-8"?><ajax-response>
ERROR: Error while parsing response: Could not find root <ajax-response> element
INFO: Invoking post-call handler(s)...
INFO: Invoking failure handler(s)...
When I replace the AjaxSubmitLink back with a SubmitLink the modal
window properly appears.
Thanks
Nili
Matej Knopp wrote:
> You have to use AjaxSubmitLink and call Window.close(target) inside the
> onSubmit(AjaxRequestTarget...) method.
>
> -Matej
>
> Nili Adoram wrote:
>
>> Hi all,
>>
>> I have a panel (named AdvancedSearchPanel) containing a Form with a
>> SubmitLink.
>>
>> I open this panel inside a modal dialog:
>>
>> final ModalWindow modal;
>> add(modal = new ModalWindow("modalAdvancedSearch"));
>>
>> final AdvancedSearchPanel searchPanel = new
>> AdvancedSearchPanel(modal
>> .getContentId());
>> modal.setContent(searchPanel);
>>
>> When the form is submitted, a message is displayed ("Reloading this
>> page will cause the modal window disappear.") and the modal window is
>> closed.
>>
>> However, the CloseButtonCallback and WindowClosedCallback are not called.
>>
>> These callbacks are only called if the close button is clicked.
>>
>> What causes the submit button to close the window?
>> How can verify that these callbacks are invoked whenever the window is
>> closed?
>>
>> Thanks,
>> Nili
>>
>>
>>
>> -------------------------------------------------------------------------
>> Take Surveys. Earn Cash. Influence the Future of IT
>> Join SourceForge.net's Techsay panel and you'll get the chance to share your
>> opinions on IT & business topics through brief surveys - and earn cash
>> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
>> _______________________________________________
>> Wicket-user mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/wicket-user
>>
>>
>
>
> -------------------------------------------------------------------------
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to share your
> opinions on IT & business topics through brief surveys - and earn cash
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> _______________________________________________
> Wicket-user mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/wicket-user
>
>
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Wicket-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-user