Suppose I want to preserve my user's raw input when I wrap some form fields
inside a FormComponentPanel after an error is generated, would I be wrong to
only update my form field's model only for the first time around and
thereafter only for Ajax requests?

 

I've notice that the raw user input is being replaced with the model value
(as expected) since this is always done inside the onBeforeRender and that I
am forced to refresh whenever Ajax is involved.

I do delegate the user input conversion to my form field and so on. I was
shocked that the FormComponentPanel reset the user's raw input when an error
was reported if I remove the if statement from the below example:

 

@Override

protected void onBeforeRender() {

  if(!hasRawInput() || getWebRequest().isAjax()) {

    formField.setDefaultModel(getDefaultModel());

  }

  ...

}

 

~ Thank you,

   Paul Bors

Reply via email to