Assuming that you don't set a model for the FormComponet won't Wicket fail
back to the CompountPropertyModel of the form?

Who will perform the conversion then?

I only override FormComponentPanel#convertInput() when I force my clients to
provide the model for my FormComponentPanel and even then I delegate the
call to another form component :)


 * {@link FormComponentPanel} that hosts the label and form component with a
shared model.<br>
 * The label can be aligned around the form field given the {@link LABEL}
value constants.
 * @param <F, M>
 *      F = The form field type (e.g. TextField, CheckBox etc.)
 *      M = The model object type of the form field
public class LabeledFormField<F extends LabeledWebMarkupContainer, M>
extends FormComponentPanel<M> {
    public LabeledFormField(String id, IModel<M> model, ...) {
     * Propagate changes into the real valid model via the
FormComponentPanel.convertInput() method.
     * {@inheritDoc}
    protected void convertInput() {
        FormComponent<?> formComponent = ...
        if(formComponent != null) {

Above class warps around all the form field I use to ensure that
accessibility is supported.

I did so per the recommendation of Wicket:

It is recommended that you override FormComponent.convertInput() and let it
set the value that represents the compound value of the nested components.
Often, this goes hand-in-hand with overriding Component.onBeforeRender(),
where you would analyze the model value, break it up and distribute the
appropriate values over the child components.

But if you have a CompoundPropertyModel, do you really need to do all this
Wouldn't the form component wrapped inside the panel handle it itself?

I had to delegate the call because I don't always use a

~ Thank you,
  Paul Bors

-----Original Message-----
From: Joachim Schrod [] 
Sent: Thursday, December 06, 2012 2:05 PM
Subject: Re: Model is null after submit, using FormComponentPanel

Paul Bors wrote:
> I would suggest overriding FormComponentPanel#convertInput() only if 
> your domain object can't be easily converted by Wicket given the model you
> If you're using CompoundPropertyModel and set the model on your 
> FormComponentPanel then your TextField ID and type should be all you 
> need for wicket to know which getter/setter to call.

Really? That's not possible in an 1.4-based application, IMHO.

FormComponentPanel is a FormComponent, i.e., it participates in conversion,
validation, and update Model. When that FormComponentPanel has an associated
model, e.g., a CompoundPropertyModel, its getInputAsArray() will return
null, null will be stored as convertedInput, and updateModel() will set the
CompoundPropertyModel's object to that null value.

When sub-widgets of a FormComponentPanel do all the work necessary, and the
FormComponentPanel has a model of its own, I often override
updateModel() to be an empty method, to prevent the behavior named above
from happening.


Joachim Schrod, Roedermark, Germany

To unsubscribe, e-mail:
For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

Reply via email to