Announcement Announcement Module
Collapse
No announcement yet.
SimpleFormController - newbie question Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • SimpleFormController - newbie question

    Hi,

    (just a newbie )
    I need FORM so I implemented SimpleFormController subclass. Now I need to check, if page has been called with param "id" - e.g.:
    Code:
    viewCustomerDetail?id=1
    And if "id" is not defined I need to redirect to e.g.
    Code:
    customersList.html
    (and if possibly add error message?)

    Problem is, that onSubmit method is called only on submitting and I guess in Map referenceData(...) is not possible to determine model and overriding isFormSubmission(...) could cause some other issues.

    Could anyone help me or refer me to some reading?

    Thanks.

  • #2
    The easiest way to do this might be to map a HandlerInterceptor to your Controller and handle this logic in there. Alternatively, just override handleRequest() perform the check and then call super.handleRequest() when you want to proceed.

    Rob

    Comment


    • #3
      Could you please give me some example? I have absolutely no idea how and where to map HandlerInterceptor.

      Unfortunetly I am not sure if SimpleFormController has method handleRequest Only I have found handleRequestInternal but it is finalised in AbstractFormController

      Comment


      • #4
        Check out section 12.4.3 of the reference manual for information on HandlerInterceptor.

        Actually, SimpleFormController does have handleRequest but it is declared final on AbstractController so a HandlerInterceptor is the best approach.

        Regards,

        Rob

        Comment

        Working...
        X