You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by TH Lim <ss...@gmail.com> on 2010/06/30 05:13:55 UTC

Mulitple Forms in ListView

Hi,

I have multiple forms in a ListView. So in order not to show the same error
messages in all feedback panels I use ContainerFeedbackMessageFilter to
filter the error messages. This didn't work and the warning was
"Component-targetted feedback message was left unrendered. This could be
because you are missing a FeedbackPanel on the page." because I use non-Ajax
form submit. 

However, if I switch to AjaxSubmitLink the problem was solved. It worked as
expected. My question is should I use Ajax submit with multiple forms in a
ListView? Am I missing anything here because the problem didn't surface for
a page with multiple forms using non-Ajax submit. 

Thanks

/lim/

Codes are included below.

<html>
<body>
<ul>
    <li wicket:id="listView">
        <form wicket:id="form">
            <input wicket:id="textfield" />
            <div wicket:id="feedback"></div>
            <!--<input type="submit" wicket:id="submitALink" />-->
            <input type="submit"  />
        </form>
    </li>
</ul>
</body>
</html>

    public MultiFormPage()
    {
        ListView<String> listView = new ListView<String>("listView",
Arrays.asList(new String[]{"a", "b"}))
        {
            @Override
            protected void populateItem(ListItem item)
            {
                Form form  = new Form("form")
                {
                    @Override
                    protected void onSubmit()
                    {

                    }
                };
                //Form form = new Form("form");
                final FeedbackPanel feedback = new FeedbackPanel("feedback",
new ContainerFeedbackMessageFilter(form));
                /*
                form.add(new AjaxSubmitLink("submitALink")
                {
                    @Override
                    protected void onSubmit(AjaxRequestTarget target,
Form<?> form)
                    {
                        target.addComponent(feedback);
                    }

                    @Override
                    protected void onError(AjaxRequestTarget target, Form<?>
form)
                    {
                        target.addComponent(feedback);
                    }
                });
                */
                form.add(new RequiredTextField<String>("textfield", new
Model()));
                form.add(feedback.setOutputMarkupId(true));
                item.add(form);
            }
        };

        add(listView);
    }
}

-- 
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Mulitple-Forms-in-ListView-tp2272668p2272668.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: Mulitple Forms in ListView

Posted by vov <vo...@mail.ru>.
Not a best solution but it works:)

final FeedbackPanel feedback = new FeedbackPanel("feedback", new
ContainerFeedbackMessageFilter(form)
        {
          @Override
          public boolean accept(FeedbackMessage message)
          {
            return requiredTextField.getModel().equals(((RequiredTextField)
message.getReporter()).getModel());
          }
        });
-- 
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Mulitple-Forms-in-ListView-tp2272668p2272703.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: Mulitple Forms in ListView

Posted by TH Lim <ss...@gmail.com>.
Sorry I didn't test it before I replied. Your solution didn't work because
for non-Ajax submit both forms r submitted. Non-ajax submit submits the page
instead of individual form in Ajax style.
-- 
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Mulitple-Forms-in-ListView-tp2272668p2274681.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: Mulitple Forms in ListView

Posted by TH Lim <ss...@gmail.com>.
Thank you for providing a solution to that.

It not so much of the solution I am looking for. I am curious why it didn't
work out of the box for non-Ajax submit but it works for AjaxSubmitLink.
Basically the code to determine if the FormComponent is the child of the
container is the same but for some reasons it didn't work out for non-Ajax
submit.

-- 
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Mulitple-Forms-in-ListView-tp2272668p2274628.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: Mulitple Forms in ListView

Posted by vov <vo...@mail.ru>.
Not a best solution but it works:)

final FeedbackPanel feedback = new FeedbackPanel("feedback", new
ContainerFeedbackMessageFilter(form)
        {
          @Override
          public boolean accept(FeedbackMessage message)
          {
            return requiredTextField.getModel().equals(((RequiredTextField)
message.getReporter()).getModel());
          }
        }); 
-- 
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Mulitple-Forms-in-ListView-tp2272668p2272729.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