Pre controller redirecting to another page after form submission

Hello.

I have a End User Form, built in Experience Studio, inside a page (let's call it FormPage). I'm able to configure a page to be redirected after form submit (SubmitPage) as well as a page to be redirected in case of error.

I've added a pre-controller to SubmitPage (ie, a page pre controller) that successfully retrieves the data from the form. This controller returns null to continue rendering SubmitPage.

So far so good. Now, I want the same pre controller (inside SubmitPage) to redirect to another page, in case of invalid data. In the End User Form, it's only possible to specify a page in case of form submit and another page in case of error/unsuccessful submit. What if I want to redirect to other pages? For instance, if the purpose of the form is to register users and someone is trying to register an already existing email, the email validation (in the pre controller) would fail and the user would be redirected to an appropriate page.

I've placed a component inside SubmitPage in which I've defined a success page (in case of correct data validation) and a error page (in case of erroneous data), so that the pre controller can redirect these pages after form validation. However, because I'm using a pre controller, I can't fetch these pages from the component.

Question 1 -> How can I fetch the pages from the component to be used in the pre controller?

Question 2 -> I feel that all these redirects are a bit tricky. Is there another way to validate/process the data coming from the form and redirect to an appropriate page without the need for a page in the middle (like SubmitPage)? Data validation is achieved by the controller in the SubmitPage (Java class). Details are appreciated.

Thanks in advance.

Comments

  • Please send the code and steps performed. Did you run toolkit to generate externals for the controllers written.

TeamSite Developer Resources

  • Docker Automation

  • LiveSite Content Services (LSCS) REST API

  • Single Page Application (SPA) Modules

  • TeamSite Add-ons

If you are interested in gaining full access to the content, you can register for a My Support account here.
image
OpenText CE Products
TeamSite
APIs