Back Forum Reply New

loadFormObject called after a submit??

Hi,

I have my objects in REQUEST scope as specified and also I have over-ridden the loadFormObject(RequestContext context) method as suggested.

Here's the issue we run into. It looks like loadFormObject is called every time the action form is invoked. For instance:It is invoked to set up data in the form, prior to the view being displayed.
It is invoked when a submit is performed.
It is invoked when the form is recalled from a successor form.

Question is: if this is true and we are setting up the form data in the loadFormObject, we can overwrite user submitted data in the loadFormObject method!!! This is obviously incorrect. So, how should we really use this method? I am currently using all kinds of workarounds to handle this behavior, but I suspect there is something we are missing.

Thanks in advance for any help,

John Brinnand

Well, it's called once per REQUEST, since your form object scope is ScopeType.Request.  If you want it called once per flow session, make it the formObjectScope ScopeType.FLOW.  Alternatively, ensure you always do a data binding and validation on each new request so changes are reapplied to the new instance.

Keith

Thanks for the reply.

My questions are:

Flow Scope: By using this scope does it mean that loadFormObject () is called when a form is first invoked and when it is recalled from a successor?   If so, that would be perfect.

Also, I notice that when the loadFormObject is called after a submit,  any form processing that is required is re-invoked, and then the newly formed object is populated with the data from the form? Is this correct or is it a result of something I am doing? And if this is the behavior - where  does the original form backing object (which is used to populate the newly created object) live?

Many thanks for your help,

John
¥
Back Forum Reply New