You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Scott Swank <sc...@gmail.com> on 2008/08/16 16:53:49 UTC

feedback question

I have FeedbackPanels for each FormComponent in a form.  They are in a
Border and use the ContainerFormComponentFilter to nab any messages
for components in the Border.  This all works as expected.

Then at the top of the form there is a FeedbackPanel that filters out
all messages whose source is a FormComponent.  This works as expected.

The last thing I need is to add a message to the form-level feedback
panel that indicates that there are messages below (whenever there are
in fact messages below).  Can I add such a message as part of my
filter's accept() method?  Or should I try to create a form-level
message as I receive the lower level messages?

Thank you,
Scott

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: feedback question

Posted by Scott Swank <sc...@gmail.com>.
Ah.  That is enormously helpful.  I misunderstood this line from the javadoc:

"These validators are added to the form and only executed if all form
components returned by getDependentFormComponents() have been
successfully validated before this validator runs."

and thought that it would enforce an ordering, where this validator
would be called after the dependent FormComponent validators.
Apparently the word "successfully" is germain.  :)

Thank you Matej!

Scott

On Sun, Aug 17, 2008 at 10:33 AM, Matej Knopp <ma...@gmail.com> wrote:
> Hi,
>
> if you add those components in getDependentFormComponents() it
> probably won't work, because the validate method will only be called
> if all of those components are valid. Which kinda renders your
> validator useless :) So your approach with returning empty list is
> probably right.
>
> -Matej
>
> On Sun, Aug 17, 2008 at 7:23 PM, Scott Swank <sc...@gmail.com> wrote:
>> If I do this with an IFormValidator do I need to return all of the
>> form components in getDependentFormComponents()?
>>
>>                IFormValidator formValidator = new IFormValidator() {
>>                        private static final long serialVersionUID = -7090261277922171782L;
>>
>>                        public FormComponent[] getDependentFormComponents() {
>>                                return new FormComponent[] {};
>>                        }
>>
>>                        public void validate(final Form form) {
>>                                form.visitChildren(FormComponent.class, new IVisitor() {
>>
>>                                        public Object component(Component component) {
>>                                                if (((FormComponent) component).isValid())
>>                                                        return IVisitor.CONTINUE_TRAVERSAL;
>>                                                else {
>>                                                        form.error("Errors below...");
>>                                                        return IVisitor.STOP_TRAVERSAL;
>>                                                }
>>                                        }
>>                                });
>>                        }
>>                };
>>
>> Thank you,
>> Scott
>>
>>
>> On Sat, Aug 16, 2008 at 7:53 AM, Scott Swank <sc...@gmail.com> wrote:
>>> I have FeedbackPanels for each FormComponent in a form.  They are in a
>>> Border and use the ContainerFormComponentFilter to nab any messages
>>> for components in the Border.  This all works as expected.
>>>
>>> Then at the top of the form there is a FeedbackPanel that filters out
>>> all messages whose source is a FormComponent.  This works as expected.
>>>
>>> The last thing I need is to add a message to the form-level feedback
>>> panel that indicates that there are messages below (whenever there are
>>> in fact messages below).  Can I add such a message as part of my
>>> filter's accept() method?  Or should I try to create a form-level
>>> message as I receive the lower level messages?
>>>
>>> Thank you,
>>> Scott
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: feedback question

Posted by Matej Knopp <ma...@gmail.com>.
Hi,

if you add those components in getDependentFormComponents() it
probably won't work, because the validate method will only be called
if all of those components are valid. Which kinda renders your
validator useless :) So your approach with returning empty list is
probably right.

-Matej

On Sun, Aug 17, 2008 at 7:23 PM, Scott Swank <sc...@gmail.com> wrote:
> If I do this with an IFormValidator do I need to return all of the
> form components in getDependentFormComponents()?
>
>                IFormValidator formValidator = new IFormValidator() {
>                        private static final long serialVersionUID = -7090261277922171782L;
>
>                        public FormComponent[] getDependentFormComponents() {
>                                return new FormComponent[] {};
>                        }
>
>                        public void validate(final Form form) {
>                                form.visitChildren(FormComponent.class, new IVisitor() {
>
>                                        public Object component(Component component) {
>                                                if (((FormComponent) component).isValid())
>                                                        return IVisitor.CONTINUE_TRAVERSAL;
>                                                else {
>                                                        form.error("Errors below...");
>                                                        return IVisitor.STOP_TRAVERSAL;
>                                                }
>                                        }
>                                });
>                        }
>                };
>
> Thank you,
> Scott
>
>
> On Sat, Aug 16, 2008 at 7:53 AM, Scott Swank <sc...@gmail.com> wrote:
>> I have FeedbackPanels for each FormComponent in a form.  They are in a
>> Border and use the ContainerFormComponentFilter to nab any messages
>> for components in the Border.  This all works as expected.
>>
>> Then at the top of the form there is a FeedbackPanel that filters out
>> all messages whose source is a FormComponent.  This works as expected.
>>
>> The last thing I need is to add a message to the form-level feedback
>> panel that indicates that there are messages below (whenever there are
>> in fact messages below).  Can I add such a message as part of my
>> filter's accept() method?  Or should I try to create a form-level
>> message as I receive the lower level messages?
>>
>> Thank you,
>> Scott
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: feedback question

Posted by Scott Swank <sc...@gmail.com>.
If I do this with an IFormValidator do I need to return all of the
form components in getDependentFormComponents()?

		IFormValidator formValidator = new IFormValidator() {
			private static final long serialVersionUID = -7090261277922171782L;

			public FormComponent[] getDependentFormComponents() {
				return new FormComponent[] {};
			}

			public void validate(final Form form) {
				form.visitChildren(FormComponent.class, new IVisitor() {

					public Object component(Component component) {
						if (((FormComponent) component).isValid())
							return IVisitor.CONTINUE_TRAVERSAL;
						else {
							form.error("Errors below...");
							return IVisitor.STOP_TRAVERSAL;
						}
					}
				});
			}
		};

Thank you,
Scott


On Sat, Aug 16, 2008 at 7:53 AM, Scott Swank <sc...@gmail.com> wrote:
> I have FeedbackPanels for each FormComponent in a form.  They are in a
> Border and use the ContainerFormComponentFilter to nab any messages
> for components in the Border.  This all works as expected.
>
> Then at the top of the form there is a FeedbackPanel that filters out
> all messages whose source is a FormComponent.  This works as expected.
>
> The last thing I need is to add a message to the form-level feedback
> panel that indicates that there are messages below (whenever there are
> in fact messages below).  Can I add such a message as part of my
> filter's accept() method?  Or should I try to create a form-level
> message as I receive the lower level messages?
>
> Thank you,
> Scott
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org