Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn More

View all

Sign in to view all badges

How to return a value from submit action and use it in the redirect page?

Avatar

Avatar
Validate 1
Level 2
urs_h_
Level 2

Likes

5 likes

Total Posts

42 posts

Correct Reply

6 solutions
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 1
Affirm 5
View profile

Avatar
Validate 1
Level 2
urs_h_
Level 2

Likes

5 likes

Total Posts

42 posts

Correct Reply

6 solutions
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 1
Affirm 5
View profile
urs_h_
Level 2

02-02-2016

Hi 

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?

Example:

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.

Regards,

Urs

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Validate 1
Level 2
urs_h_
Level 2

Likes

5 likes

Total Posts

42 posts

Correct Reply

6 solutions
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 1
Affirm 5
View profile

Avatar
Validate 1
Level 2
urs_h_
Level 2

Likes

5 likes

Total Posts

42 posts

Correct Reply

6 solutions
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 1
Affirm 5
View profile
urs_h_
Level 2

09-02-2016

Hi Varun 

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,

Urs

Answers (9)

Answers (9)

Avatar

Avatar
Validate 10
Level 3
srikanthp689160
Level 3

Likes

20 likes

Total Posts

95 posts

Correct Reply

0 solutions
Top badges earned
Validate 10
Validate 1
Ignite 5
Ignite 3
Ignite 1
View profile

Avatar
Validate 10
Level 3
srikanthp689160
Level 3

Likes

20 likes

Total Posts

95 posts

Correct Reply

0 solutions
Top badges earned
Validate 10
Validate 1
Ignite 5
Ignite 3
Ignite 1
View profile
srikanthp689160
Level 3

26-02-2018

Hi Urs,

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,

Srikanth Pogula.

Avatar

Avatar
Validate 1
Level 6
Jared_Langdon
Level 6

Likes

19 likes

Total Posts

305 posts

Correct Reply

1 solution
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 10
Boost 1
View profile

Avatar
Validate 1
Level 6
Jared_Langdon
Level 6

Likes

19 likes

Total Posts

305 posts

Correct Reply

1 solution
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 10
Boost 1
View profile
Jared_Langdon
Level 6

30-07-2018

Thanks Mayank.  I would like to use another form as my thank you page.  That seems to work, but I can't figure out how to pass data from my first form to the second one. 

Avatar

Avatar
Validate 1
Level 10
Mayank_Gandhi
Level 10

Likes

284 likes

Total Posts

1,105 posts

Correct Reply

182 solutions
Top badges earned
Validate 1
Contributor 2
Ignite 5
Ignite 3
Ignite 10
View profile

Avatar
Validate 1
Level 10
Mayank_Gandhi
Level 10

Likes

284 likes

Total Posts

1,105 posts

Correct Reply

182 solutions
Top badges earned
Validate 1
Contributor 2
Ignite 5
Ignite 3
Ignite 10
View profile
Mayank_Gandhi
Level 10

16-07-2018

Hi Jared,

You can create your own template[0] and then create a custom thank-you page based on your template.

[0] Creating Page Templates / Introducing Editable Templates - YouTube

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).

1529327_pastedImage_3.png

Avatar

Avatar
Validate 1
Level 6
Jared_Langdon
Level 6

Likes

19 likes

Total Posts

305 posts

Correct Reply

1 solution
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 10
Boost 1
View profile

Avatar
Validate 1
Level 6
Jared_Langdon
Level 6

Likes

19 likes

Total Posts

305 posts

Correct Reply

1 solution
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 10
Boost 1
View profile
Jared_Langdon
Level 6

16-07-2018

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.

Avatar

Avatar
Boost 3
Level 2
varundua
Level 2

Likes

4 likes

Total Posts

32 posts

Correct Reply

10 solutions
Top badges earned
Boost 3
Boost 1
Affirm 5
Affirm 3
Affirm 10
View profile

Avatar
Boost 3
Level 2
varundua
Level 2

Likes

4 likes

Total Posts

32 posts

Correct Reply

10 solutions
Top badges earned
Boost 3
Boost 1
Affirm 5
Affirm 3
Affirm 10
View profile
varundua
Level 2

09-02-2016

Hi Urs,

From the documentation[1]

After performing the required action, the Submit servlet forwards the request to the forward path. An action uses the setForwardPath API to set the forward path in the Guide Submit servlet. 

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)

[1]  https://helpx.adobe.com/aem-forms/6-1/custom-submit-action-form.html

Regards

Varun

Avatar

Avatar
Validate 1
Level 2
urs_h_
Level 2

Likes

5 likes

Total Posts

42 posts

Correct Reply

6 solutions
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 1
Affirm 5
View profile

Avatar
Validate 1
Level 2
urs_h_
Level 2

Likes

5 likes

Total Posts

42 posts

Correct Reply

6 solutions
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 1
Affirm 5
View profile
urs_h_
Level 2

08-02-2016

Hi arvmohan

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,

Urs

Avatar

Avatar
Affirm 1
Level 1
arvmohan
Level 1

Likes

0 likes

Total Posts

5 posts

Correct Reply

1 solution
Top badges earned
Affirm 1
View profile

Avatar
Affirm 1
Level 1
arvmohan
Level 1

Likes

0 likes

Total Posts

5 posts

Correct Reply

1 solution
Top badges earned
Affirm 1
View profile
arvmohan
Level 1

08-02-2016

Hi Urs,

In your custom submit action, you yourself can redirect to Thank You page after your submission workflow is completed. You can get url for thank you page from ":redirect" parameter from the request.

Avatar

Avatar
Validate 1
Level 2
urs_h_
Level 2

Likes

5 likes

Total Posts

42 posts

Correct Reply

6 solutions
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 1
Affirm 5
View profile

Avatar
Validate 1
Level 2
urs_h_
Level 2

Likes

5 likes

Total Posts

42 posts

Correct Reply

6 solutions
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 1
Affirm 5
View profile
urs_h_
Level 2

03-02-2016

Hi Mandeep

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

Regards,

Urs

Avatar

Avatar
Boost 5
Employee
mandeepg6805152
Employee

Likes

7 likes

Total Posts

47 posts

Correct Reply

28 solutions
Top badges earned
Boost 5
Boost 3
Boost 1
Affirm 5
Affirm 3
View profile

Avatar
Boost 5
Employee
mandeepg6805152
Employee

Likes

7 likes

Total Posts

47 posts

Correct Reply

28 solutions
Top badges earned
Boost 5
Boost 3
Boost 1
Affirm 5
Affirm 3
View profile
mandeepg6805152
Employee

03-02-2016