I wonder how I can make my custom submit action returning a value and have this value available on the redirect page saying as url parameter?
1) submit action generates a kind of ticket number
2) i want to use the ticket number previously generated by the submit action in a link on redirect page.
with the help of your answer and the answer from Mandeep (http://help-forums.adobe.com/content/adobeforums/en/experience-manager-forum/aem-forms.topic.html/fo...) I could eventually pass a custom parameter to the redirect page 🙂
I'm using this dependency (in the bundle's pom.xml) to have the GuideSubmitServlet available in my custom submit action:
<dependency> <groupId>com.adobe.aemfd</groupId> <artifactId>aemfd-client-sdk</artifactId> <version>6.1.0</version> <scope>provided</scope> </dependency>
and I'm using this code in the submit action to add a custom parameter to the url of the redirect page:
Map<String, String> redirectParameters = GuideSubmitServlet.getRedirectParameters(request); redirectParameters.put("answerToTheUltimateQuestion","42"); GuideSubmitServlet.setRedirectParameters(request,redirectParameters);
Thanks a lot four your help,
Can you please let me know what is required to be redirected/forwarded to a page on form submission.
It works perfectly fine on adaptive form page but when i embed adaptive form on a sites page using OOTB AEM Form component (fd/af/components/aemform), submit button does not work, give me below exception
java.lang.IllegalArgumentException: Not a valid identifier 'index,index.html'.
Also, i would like to know how can we access custom parameter which was set in redirectParameters on thank you page.
I have configured target page in AEM Form component as well as in adaptive form page, Adaptive Form Container -> Submission section.
Thanks & Regards,
You can create your own template and then create a custom thank-you page based on your template.
Once you have your Page ready you can simply go the Adaptive form root container and set the redirect URL. Even if you do not have custom template or Page you can use the Sample templates provided for the testing purpose and create a page using we.retail or we. Gov (http://localhost:8080/lc/sites.html/content).
I have the same question. I'm having trouble finding documentation that describes how to set up a custom thank you page. Is there documentation or a blog post or a tutorial or an article on this anywhere? Srikanth, did you find a solution? Can you share it here? Much appreciated if you can. Thanks.
From the documentation
If the action doesn't provide a forward path, the Submit servlet redirects the browser using the Redirect URL. The author configures the Redirect URL using the Thank You Page configuration in the Adaptive Form Edit dialog. You can also configure the Redirect URL through the Submit action or the setRedirectUrl API in the Guide Submit servlet. You can also configure the Request parameters sent to the Redirect URL using the setRedirectParameters API in the Guide Submit servlet.
We have a public API but seems like its missed in the documentation. To set the redirect url and parameters you can use the following APIs.
com.adobe.aemds.guide.servlet.GuideSubmitServlet public static void setRedirectUrl(final SlingHttpServletRequest req, final String redirectUrl) public static void setRedirectParameters(SlingHttpServletRequest request, Map<String, String> value)
I've already tried this by writing a custom URL to the reponse's location attribute in the header.
response.setStatus(302); response.setHeader("Location", <custom redirect url>);
But setting the header in the custom submit action throws an IllegalStateException. Maybe the exception is thrown because the GuideSubmitServlet has already started to write to the response before my custom submit action is called.
Is there another possibility to set the redirect location?
thank you for your answer. The doc you'are referring to, does not describe how I can pass parameters back from a custom submit action to the redirection page.. Flow chart from https://helpx.adobe.com/aem-forms/6-1/custom-submit-action-form.html