2

I want to clear form components (textfields etc) and it model. On submit method, after persisting the model correctly, I call clearInput(), but nothing happends to model and fields still filled.

Am I forgetting something about clearInput() method?

tomrlh
  • 1,006
  • 1
  • 18
  • 39

1 Answers1

1

In addition to clearInput() you need to set an empty model object and to rerender the form.

Please show us your code if these suggestions do not help.

martin-g
  • 17,243
  • 2
  • 23
  • 35
  • Yes it worked, adding `getModel().setObject(new ModelClass());` to _onSubmit()_ it clears the form as wanted and still working properly. The strange is _clearInput()_ is not necessary.. just the line above... do you know why? – tomrlh Feb 03 '18 at 06:24
  • `clearInput()` is used to get rid of invalid input, that wasn't transferred into your models. If your form submits without validation errors, there's no input to clear. – svenmeier Feb 03 '18 at 11:10