I for one can't follow your example but sounds to me that you are setting
your model on the form and are using collections.

First use-case like that which comes to my mind is a list of selected radio
and check boxes or multiple selections in a select box.

Using Wicket you shouldn't have to work too hard on updating the model
object (be it a collection) to update it with the user input. Wicket should
do that for you and if it's not working you might be doing something wrong
or forgetting something else.

I would suggest to take a look at how CollectionModel is used:
http://www.wicket-library.com/wicket-examples/compref/wicket/bookmarkable/or
g.apache.wicket.examples.compref.PalettePage?0

Perhaps that can aid answering your quest.

Otherwise, please better phrase your question and/or submit some code
examples to help us better understand.

~ Thank you,
  Paul Bors

-----Original Message-----
From: Nick Pratt [mailto:nbpr...@gmail.com] 
Sent: Monday, December 10, 2012 1:11 PM
To: users@wicket.apache.org
Subject: Form submit with Collection<Child>

My understanding of Form submit behavior with models is that onSubmit,
Wicket loads the model, and then applies all the changed form values to that
model.  This works fine for non-collection types (Strings, ints etc) set
from all the input types Ive been using (TextField, RadioChoice, DDC etc.).

However, what is not working is the addition of new Entities that live
inside a Collection of the IModel entity.  Lets say I have a 1..N
relationship, A..B, and I want to add 2 new Bs to A's collection (a fairly
common requirement) in my form. I dont want these new B entities persisted
in the DB until the entire form is submitted (Im using JPA cascade).   How
do I code this part of the form/logic so that when I hit submit, I get those
2 new B entities added to the A.b collection, so that I can save(a) and have
everything update?

Regards

Nick


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

Reply via email to