I created https://issues.apache.org/jira/browse/WICKET-3765 and attached a
quickstart.

I commented out the Form in the quickstart. Just uncomment those lines to
see the bug.

Regarding the strangeness of the Form in the FormComponent: I may be able to
remove the Form. This is an older component that I created over a year ago
and finally figured out how to do it correctly when reading the Wicket
Cookbook, which exposed this behavior.

I may be able to refactor the inner Form out of the FormComponent, but the
nature of my component is that the repeating element (as in a TextField) is
configurable so it could be a TextField, or  some other custom field (which
could in turn have a possible inner form) so I want to make it as resilient
as possible.

Thanks!

-Clint

On Thu, Jun 2, 2011 at 9:42 PM, Igor Vaynberg <igor.vaynb...@gmail.com>wrote:

> create a quickstart and we can see if there is an easy fix. at first
> glance it seems rather strange to have a form inside a
> formcomponentpanel....
>
> -igor
>
> On Wed, Jun 1, 2011 at 6:56 PM, Clint Checketts <checke...@gmail.com>
> wrote:
> > I finally had a chance to create a quickstart and play with it. The issue
> > happens when my FormComponentPanel has its own form. So it appears that
> the
> > inner form delays the processing of those inner elements.
> >
> > Once I removed the inner form so the child FormComponents were added
> > directly to my FormComponentPanel the getConvertedInput worked as
> expected.
> >
> > <wicket:panel>
> > <form wicket:id="form">   <----------------------------This inner form in
> > the panel was the culprit!
> > <div wicket:id="namesList">
> >    <label wicket:id="label"></label>
> >    <input wicket:id="name" />
> >
> > </div>
> > </form>
> > </wicket:panel>
> >
> > So this leads into another question: Is the a better solution to making
> it
> > work if I can't remove the inner form?
> >
> >
> > -Clint
> >
> > On Thu, May 19, 2011 at 11:16 AM, Clint Checketts <checke...@gmail.com
> >wrote:
> >
> >> I'll validate my code again. It is running on Wicket 1.4.1 so maybe it
> was
> >> linked to the older version.
> >>
> >> Thanks everyone for the help, its good to know that it is working
> correctly
> >> for others.
> >>
> >> -Clint
> >>
> >> On Thu, May 19, 2011 at 7:51 AM, Bertrand Guay-Paquet <
> >> ber...@step.polymtl.ca> wrote:
> >>
> >>> Hi,
> >>>
> >>> I am doing the same kind of processing and it works fine. I have a
> >>> FormComponentPanel with children FormComponentPanels. Here is what the
> >>> convertInput() method looks like for the "root" FormComponentPanel:
> >>> protected void convertInput() {
> >>>    // Retrieve all children
> >>>    final List<Foo> fooList = new ArrayList<Foo>();
> >>>    foosRepeater.visitChildren(FooFormFields.class,
> >>>            new IVisitor<FooFormFields, Void>() {
> >>>                @Override
> >>>                public void component(FooFormFields a_object,
> IVisit<Void>
> >>> a_visit) {
> >>>                    Foo foo = a_object.getConvertedInput();
> >>>                    if (foo != null) {
> >>>                        fooList.add(foo);
> >>>                    }
> >>>                }
> >>>            });
> >>>    setConvertedInput(fooList);
> >>> }
> >>>
> >>> All the children validators are called and their convertedInput is
> >>> properly set.
> >>>
> >>> Bertrand
> >>>
> >>>
> >>>
> >>> On 16/05/2011 5:35 PM, Clint Checketts wrote:
> >>>
> >>>>   I have a FormComponentPanel that contains multiple child
> formcomponent.
> >>>> The purpose of this panel is to be able to add in several cihldren
> >>>> dynamically. The end model is supposed to be the list from all the
> >>>> children
> >>>> component. I get the value in my convertInput() method by iterating
> over
> >>>> all
> >>>> the children components, calling each one's getConvertedInput()
> >>>>
> >>>> Here's the problem, the child component's values haven't
> convertedTheir
> >>>> input at that point, so i call 'validate()' on each one to trigger
> that
> >>>> coversion.  Is that the right way to approach this? Am i causing
> >>>> unneeded/duplicate processing?
> >>>> .
> >>>>
> >>>> protected void convertInput() {
> >>>>   final ArrayList<T>  convertedInputList = new ArrayList<T>();
> >>>>   inForm.visitFormComponents(new IVisitor() {
> >>>>    public Object formComponent(IFormVisitorParticipant formComponent)
> {
> >>>>     if (formComponent instanceof FormComponent<?>) {
> >>>>      FormComponent<T>  fc = (FormComponent<T>) formComponent;
> >>>>      *fc.validate();
> >>>> *     T convertedInput =  *fc.getConvertedInput();
> >>>> *     if(null != convertedInput){
> >>>>       convertedInputList.add(convertedInput);
> >>>>      }
> >>>>     }
> >>>>     return Component.IVisitor.CONTINUE_TRAVERSAL;
> >>>>    }
> >>>>   });
> >>>>   setConvertedInput(convertedInputList);
> >>>>  }
> >>>>
> >>>>  Thanks,
> >>>>
> >>>> -Clint
> >>>>
> >>>>
> >>>  ---------------------------------------------------------------------
> >>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> >>> For additional commands, e-mail: users-h...@wicket.apache.org
> >>>
> >>>
> >>
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>

Reply via email to