Announcement Announcement Module
No announcement yet.
Form calling another form does not call referenceData() Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Form calling another form does not call referenceData()

    I can't seem to find the problem to this one. I have a SimpleFormControler's onSubmit event that processes database stuff then needs, in some cases, to pass the model to another form for more data entry. I tried setFormView("edit"); return showForm() and return new ModelAndView("edit",errors.getModel()); and the new form loads with the model but the form's referenceData() is not called so my comboboxes are empty!

    Is there a way to do it without AbstractWizardFormController??
    Any ideas????


  • #2
    You'll have to trigger the second form controller, not just forward it to the view of the second form. When just returning the form view, the controller will never be triggered and the referenceData method will never get called (just as any other initailization methods of the form).

    Use a RedirectView to redirect to the URL of the second form controller for instance. Result would be that you have to re-initialize the command object however, unless you put it in the session yourself and retrieve it again in the second form controller.

    Remember: request causes controller to get trigger which returns a view. A view (unless you're using the RedirectView) can never cause actions to be performed on the controller.


    • #3
      Aaaaaah! Gotcha! That's what I was looking for. Thanks!

      However, when the <"sessionForm"> property is set to "true" in the application context isn't the command already supposed to be in the session? In that case, is the command still there after the redirectView?

      Thanks again!