This doesn't really make sense. Why are you using self updating
behavior? Why don't you just update the listview when user submits the
form? And you can't ajax-update a repeater (ListView) directly. You have
to put the listview to e.g. WebMarkupContainer and add the container to
the AjaxRequestTarget.

-Matej

Carfield Yim wrote:
> I have refer to
> 
> http://www.wicket-library.com/wicket-examples/ajax?wicket:bookmarkablePage=:wicket.examples.ajax.builtin.FormPage
> and
> http://www.wicket-library.com/wicket-examples/ajax?wicket:bookmarkablePage=:wicket.examples.ajax.builtin.ClockPage
> 
> But I cannot make the ModalWIndow updatable, Basically it is a form
> contain a listview which will update after the user make some search, I
> added an AjaxSelfUpdatingTimerBehavior to that listview and try to make
> it update after the form submit, but it don't work, would you let me
> know what am I doing wrong? BTW, I have validate that
> AjaxSubmitButton.onsubmit is executed
> 
> 
>     public NewAccount(String id) {
>         super(id);
>         WicketUtil.standardHeader(this);
>         add(new NewAccountForm("form"));
>         add(new FeedbackPanel("feedback"));
>         add(userListView = new ListView("users", userList) {
>             private static final long serialVersionUID = 1L;
> 
>             public void populateItem(final ListItem listItem) {
>                 final User user = (User) listItem.getModelObject();
>                 listItem.add(new Link("href") {
>                     private static final long serialVersionUID = 1L;
> 
>                     @Override
>                     public void onClick() {
>                         try {
>                             final Account account = new Account();
>                             account.setAccountID(WicketUtil.getAccountId());
>                             WicketUtil.addAccountForUser(user, account);
>                             redirectToInterceptPage(new Edit(account));
>                         } catch (SQLException e) {
>                             throw new RuntimeException(e);
>                         }
>                     }
>                 }.add(new Label("label", user.getUsername())));
>             }
>         });
>         userListView.add(new
> AjaxSelfUpdatingTimerBehavior(Duration.seconds(1)));
>     }
> 
>     public final class NewAccountForm extends Form {
>         private static final long serialVersionUID = 1L;
> 
>         private String keyword;
> 
>         public String getKeyword() {
>             return keyword;
>         }
> 
>         public String getKeywordWildcard() {
>             return keyword == null ? "%" : "%" + keyword.toLowerCase() +
> "%";
>         }
> 
>         public void setKeyword(String keyword) {
>             this.keyword = keyword;
>         }
> 
>         public NewAccountForm(final String id) {
>             super(id);
>             final TextField username;
>             add(username = new RequiredTextField("keyword", new
> PropertyModel(this, "keyword")));
>             add(new AjaxSubmitButton("ajax-submit-button", this) {
>                 private static final long serialVersionUID = 1L;
>                 protected void onSubmit(AjaxRequestTarget target, Form
> form) {
>                     try {
>                         final boolean isNew =
> Boolean.parseBoolean(getRequest().getParameter("isnew"));
>                         if (isNew) {
> 
> if(UsernameValidator.userNameDuplication(username, null))
>                                 NewAccount.this.error("user with same
> username already exist");
>                             else {
>                                 final User user = new User();
>                                 user.setUsername(getKeyword());
>                                 final Account account = new Account();
> 
> account.setAccountID(WicketUtil.getAccountId());
>                                 if
> (WicketUtil.addCustomer(NewAccount.this, user, account, true))
>                                     redirectToInterceptPage(new
> Edit(account));
>                             }
>                         } else {
>                             userList.clear();
> 
> userList.addAll(Application.sqlMap.queryForList("searchUserByNameOrEmail",
> 
>     getKeywordWildcard()));
>                             if (userList.size() > 0) {
>                                 NewAccount.this.info("Just click at the
> username to add new account for that user");
>                             }
>                             userListView.modelChanged();
>                             target.addComponent(userListView);
>                         }
>                     } catch (SQLException e) {
>                         throw new RuntimeException(e);
>                     }
>                 }
>             });
>         }
>     }
> 
> On 1/3/07, Martijn Dashorst <[EMAIL PROTECTED]> wrote:
>> You can't.
>>
>> You have to submit the form using ajax.
>>
>> Martijn
>>
>> On 1/3/07, Carfield Yim <[EMAIL PROTECTED]> wrote:
>>> If I have a form inside a ModalWindow, submit the form will cause the
>>> ModalWindow close. Can I prevent this behaviour?
>>>
>>>
> -------------------------------------------------------------------------
>>> 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
>>>
>>
>> --
>> Vote for Wicket at the
> http://www.thebeststuffintheworld.com/vote_for/wicket
>> Wicket 1.2.4 is as easy as 1-2-4. Download Wicket now!
>> http://wicketframework.org
>>
>> -------------------------------------------------------------------------
>> 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

Reply via email to