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 <[EMAIL PROTECTED]> 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 <[EMAIL PROTECTED]> 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 <[EMAIL PROTECTED]> 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: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to