Quick search:


How to override what happens after saving from an EditDetailsPage

When the user presses the New or the Update button on an EditDetailsPage, the editDetaisForm is submitted. Because of the pntHandler field in the form, the request is handled by an instance of a subclass of PntObjectSaveAction. Which class exactly is decided in the same way as with pages, see how to specialize a page.

The saveAction converts and validates the values form the form, see how to convert and validate user input. If the form contains errors, the user is returend to the same page where an error message is shown. To override this you can override the finishFailure function on the subclass.

If the form is validated the peanut is saved. By default the browser is then redirected to the context page. What the context is depends on Context Scouting. Context Scouting depends on parameters passed by the urls, forms and buttons, if some of these parameters is missing it may have errornous results. See how to improve context scouting.

To override redirection to the context page and have the user be returned on the same EditDetailsPage, you can modify the pntBackToOrigin parameter in the editDetailsForm. The value of this parameter is produced by the pnt.web.pages.PntObjectEditDetailsPage::getBackToOrigin function on the EditDetailsPage. To override this function you may have to specialize the page first.

You can also override the redirection by overriding the finishSuccess function on the PntObjectSaveAction subclass. Here you can decide yourself were you want to redirect to. Also see example 7. You can also override the getBackToOriginRequestData function to change the origin, or override the finishAndRedirectToContext function if more appropriate.