multiple feedback panels in same page

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

multiple feedback panels in same page

Jason Novotny-2
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
Reply | Threaded
Open this post in threaded view
|

Re: multiple feedback panels in same page

jeremy@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 <[hidden email]> 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: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>
Reply | Threaded
Open this post in threaded view
|

Re: multiple feedback panels in same page

Jason Novotny-2
In reply to this post by Jason Novotny-2
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
Reply | Threaded
Open this post in threaded view
|

Re: multiple feedback panels in same page

jeremy@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 <[hidden email]> 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: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>


--
Jeremy Thomerson
http://www.wickettraining.com
Reply | Threaded
Open this post in threaded view
|

Re: multiple feedback panels in same page

Jason Novotny-2
In reply to this post by jeremy@wickettraining.com

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 <novotny@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
>
>
Reply | Threaded
Open this post in threaded view
|

Re: multiple feedback panels in same page

satar
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!
Reply | Threaded
Open this post in threaded view
|

Re: multiple feedback panels in same page

pinkhamj
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 <[hidden email]> 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: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>
Reply | Threaded
Open this post in threaded view
|

Re: multiple feedback panels in same page

mrblobby
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?

Reply | Threaded
Open this post in threaded view
|

Re: multiple feedback panels in same page

Arjun Dhar
Hey i think this is documented, thats how 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 "<span style='color: red'>&nbsp;X</span>";
	}
}
..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
Software documentation is like sex: when it is good, it is very, very good; and when it is bad, it is still better than nothing!