You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by novotny <no...@gridsphere.org> on 2009/03/02 23:54:05 UTC

multiple feedback panels in same page

Hi,

I have two feedback panels in the same page and want to direct my info
message to only one of them. Any ideas on how to do this? Right now when I
do "info("hello")" "hello" shows up in both panels.

Thanks, Jason
-- 
View this message in context: http://www.nabble.com/multiple-feedback-panels-in-same-page-tp22298693p22298693.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: multiple feedback panels in same page

Posted by Arjun Dhar <dh...@yahoo.com>.
Hey i think this is documented, thats who I got to know.

Basically a 2 step process. You create a Behavior like:

/**
 * This class defines a behavior so that in Feedback (on validation errors)
individual
 * fields can be marked by the markup provided by the {@link
this#getErrorMarkup()}
 * @author Arjun Dhar
 *
 * @param <T>
 */
public class MarkErrorFieldBehavior<T> extends AbstractBehavior {
	private static final long serialVersionUID = 1L;

	@SuppressWarnings("unchecked")
	@Override
	public void onRendered(Component component) {
		FormComponent<T> fc = (FormComponent<T>) component;
		if (!fc.isValid()) {
			Response response = component.getResponse();
			response.write(getErrorMarkup());
		}
	}
	
	/**
	 * Provide HTML markup to mark the error field<br/>
	 * Example: &lt;span style='color: red'&gt;*&lt;/span&gt;
	 * 
	 * @return
	 */
	protected String getErrorMarkup() {
		return "&nbsp;X";
	}
}

..and for your field all you have to do is ".add(new
MarkErrorFieldBehavior<Double>())" -- add the behavior to it.

In my case I'm happy with "X" appearing. Adapt it to put the field name or
whatever text you want!
-Arjun
-- 
View this message in context: http://apache-wicket.1842946.n4.nabble.com/multiple-feedback-panels-in-same-page-tp1886384p3217575.html
Sent from the Users forum 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: multiple feedback panels in same page

Posted by mrblobby <si...@hotmail.com>.
This does not work for me:

        final Form<String> form = new Form<String>("form");

        ComponentFeedbackMessageFilter filter = new
ComponentFeedbackMessageFilter(form);

        FeedbackPanel feedback = new FeedbackPanel("feedback", filter);
        feedback.setEscapeModelStrings(false);
        add(feedback);

None of the field level validation messages of the form go into this
feedback panel - which seems like a  bug.

I could create a feedback panel for every field - that works fine, but this
is 
a) too much work
b) you lose the errors on a long form - you need them at the top of the form
as well.

So I dont see why anyone would add a feedback panel to a form if it doesnt
actually catch any of the field validation.  Or are you supposed to write
some code on each field, catch this, and manually write to the forms
feedback panel using form.info(xx)?

If I use ContainerFeedbackMessageFilter then I get the feedback messages in
all my feedback panels - including my global one for the separate global
login form which is also pants.

Any ideas how to have 2 separate feedbacks for 2 separate forms, plus a
global one for anything outside this?


-- 
View this message in context: http://apache-wicket.1842946.n4.nabble.com/multiple-feedback-panels-in-same-page-tp1886384p3217563.html
Sent from the Users forum 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: multiple feedback panels in same page

Posted by Jim Pinkham <pi...@gmail.com>.
I just had this page with 2 forms issue - each form has some
RequiredTextFields, and some fields with custom StringValidators that I
didn't want to change from error to form.error.

This thread got me 90% of the way there, but

new FeedbackPanel("feedback", new *Container*FeedbackMessageFilter(myForm))

did the trick for my situation.

Just thought I'd mention it for benefit of fellow googlers in case they try
*Component*FeedbackMessageFilter and wonder where the messages went...
-- Jim P.
On Fri, Aug 21, 2009 at 8:34 PM, satar <st...@gmail.com> wrote:

>
> Thank you for the quick example. I think I actually seen this way of
> setting
> up a feedback panel at one point in time but had forgotten and then bumped
> into the problem of having two feedback panels on one page. This got me
> moving on quickly -- thank again!
> --
> View this message in context:
> http://www.nabble.com/multiple-feedback-panels-in-same-page-tp22298693p25089341.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: multiple feedback panels in same page

Posted by novotny <no...@gridsphere.org>.

Great-- for those googling, this works:

        final Form<String> form = new Form<String>("form");

        ComponentFeedbackMessageFilter filter = new
ComponentFeedbackMessageFilter(form);

        FeedbackPanel feedback = new FeedbackPanel("feedback", filter);
        feedback.setEscapeModelStrings(false);
        add(feedback);

      and then elsewhere in the code I can do:

     form.info("hello world");

Thanks!

Jeremy Thomerson-5 wrote:
> 
> there's a filter interface that you can use with the feedback panel that
> allows you to filter just the messages you want in that panel.  i.e., you
> could have a FBP by every form component and only show the messages
> generated by that component.
> 
> -- 
> Jeremy Thomerson
> http://www.wickettraining.com
> 
> On Mon, Mar 2, 2009 at 4:54 PM, novotny <no...@gridsphere.org> wrote:
> 
>>
>> Hi,
>>
>> I have two feedback panels in the same page and want to direct my info
>> message to only one of them. Any ideas on how to do this? Right now when
>> I
>> do "info("hello")" "hello" shows up in both panels.
>>
>> Thanks, Jason
>> --
>> View this message in context:
>> http://www.nabble.com/multiple-feedback-panels-in-same-page-tp22298693p22298693.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
>>
>>
> 
> 

-- 
View this message in context: http://www.nabble.com/multiple-feedback-panels-in-same-page-tp22298693p22299635.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: multiple feedback panels in same page

Posted by Jeremy Thomerson <je...@wickettraining.com>.
there's a filter interface that you can use with the feedback panel that
allows you to filter just the messages you want in that panel.  i.e., you
could have a FBP by every form component and only show the messages
generated by that component.

-- 
Jeremy Thomerson
http://www.wickettraining.com

On Mon, Mar 2, 2009 at 4:54 PM, novotny <no...@gridsphere.org> wrote:

>
> Hi,
>
> I have two feedback panels in the same page and want to direct my info
> message to only one of them. Any ideas on how to do this? Right now when I
> do "info("hello")" "hello" shows up in both panels.
>
> Thanks, Jason
> --
> View this message in context:
> http://www.nabble.com/multiple-feedback-panels-in-same-page-tp22298693p22298693.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: multiple feedback panels in same page

Posted by Jeremy Thomerson <je...@wickettraining.com>.
Best thing for you to do would be browse the source of the
already-implemented-in-core implementations:

IFeedbackMessageFilter

All Known Implementing Classes:
    ComponentFeedbackMessageFilter, ContainerFeedbackMessageFilter,
ErrorLevelFeedbackMessageFilter

On Mon, Mar 2, 2009 at 5:04 PM, novotny <no...@gridsphere.org> wrote:

>
> Do you have some simple example where only a feedback message created from
> the class that page that instantiates the feedbackpanel can display a
> message... or maybe any example will do since I couldn't see any from
> googling... :-)
>
> Thanks again, Jason
>
>
> novotny wrote:
> >
> > Hi,
> >
> > I have two feedback panels in the same page and want to direct my info
> > message to only one of them. Any ideas on how to do this? Right now when
> I
> > do "info("hello")" "hello" shows up in both panels.
> >
> > Thanks, Jason
> >
>
> --
> View this message in context:
> http://www.nabble.com/multiple-feedback-panels-in-same-page-tp22298693p22298900.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
>
>


-- 
Jeremy Thomerson
http://www.wickettraining.com

Re: multiple feedback panels in same page

Posted by novotny <no...@gridsphere.org>.
Do you have some simple example where only a feedback message created from
the class that page that instantiates the feedbackpanel can display a
message... or maybe any example will do since I couldn't see any from
googling... :-)

Thanks again, Jason


novotny wrote:
> 
> Hi,
> 
> I have two feedback panels in the same page and want to direct my info
> message to only one of them. Any ideas on how to do this? Right now when I
> do "info("hello")" "hello" shows up in both panels.
> 
> Thanks, Jason
> 

-- 
View this message in context: http://www.nabble.com/multiple-feedback-panels-in-same-page-tp22298693p22298900.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