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

Display redirected parameters(from servlet response) in redirected page

Avatar

Avatar
Validate 10
Level 2
sankarr26533925
Level 2

Likes

6 likes

Total Posts

46 posts

Correct Reply

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

Avatar
Validate 10
Level 2
sankarr26533925
Level 2

Likes

6 likes

Total Posts

46 posts

Correct Reply

0 solutions
Top badges earned
Validate 10
Validate 1
Ignite 3
Ignite 1
Give Back 5
View profile
sankarr26533925
Level 2

31-12-2019

Form A has few fields and submit button. For form submission, we are using Submit to Rest End point(Sling AEM servlet) and adding redirect URL as Form B path

 

We will get ID value as part of sling AEM servlet response. This ID has to shown in Form B.

 

I have gone through all the below links and could not find how to get ID value in Form B. Please read my question clearly and provide your response. Thanks in advance.

 

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

AEM 6.0 Forms Help | Writing custom Submit action for adaptive forms

https://stackoverflow.com/questions/31454357/aem-6-1-sightly-basic-form-submit-and-redirect-to-same-... 

 

 

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Boost 1
Level 1
ksetti
Level 1

Like

1 like

Total Posts

1 post

Correct Reply

1 solution
Top badges earned
Boost 1
Affirm 1
View profile

Avatar
Boost 1
Level 1
ksetti
Level 1

Like

1 like

Total Posts

1 post

Correct Reply

1 solution
Top badges earned
Boost 1
Affirm 1
View profile
ksetti
Level 1

07-04-2020

Hi Sankar, 

 

If you haven't get the answer, you can try below. Just have this code in your submit servlet. 

import com.adobe.aemds.guide.servlet.GuideSubmitServlet;

 

Map<String, String> redirectParameters = GuideSubmitServlet.getRedirectParameters(slingRequest);

redirectParameters.put("responseId", responseId);

GuideSubmitServlet.setRedirectParameters(slingRequest, redirectParameters);

 

You can capture this value using javascript callback function in submit button rule and pass this value to formB

guideBridge.submit({
  error : function (guideResultObject) {//log message},
  success : function (guideResultObject) {
alert(guideResultObject.data.responseId);
}
});

 

Answers (2)

Answers (2)

Avatar

Avatar
Validate 10
Level 2
sankarr26533925
Level 2

Likes

6 likes

Total Posts

46 posts

Correct Reply

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

Avatar
Validate 10
Level 2
sankarr26533925
Level 2

Likes

6 likes

Total Posts

46 posts

Correct Reply

0 solutions
Top badges earned
Validate 10
Validate 1
Ignite 3
Ignite 1
Give Back 5
View profile
sankarr26533925
Level 2

09-01-2020

@Mayank_Gandhi

 

Thanks for your response.

 

In the servlet where you are handling the request/response, append the ID in the form B path that you created and fetch it in the form.

 

==>I assume that ID should be added as query param in form B path. I want to show this ID in textbox(added in form fragment in Form B.

==> In this scenario, where we have to read this ID value and display in textbox. Is it from rule editor or some other place?) ]

 

 

2. Don't use 2 forms, rather have two fragments. Create button to submit in fragment 1 keeping the fragment 2 hidden, on callback hide the frag1 and set the field of fragment 2(form B in your case).

 

==>Form A is initial dialog for creating more than 10 different forms. I can't add that Form A and Form B as single fragment in single form because Form B(contains more than 8 childpanels) will be different for 10 different forms.

 

==> For example 

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

05-01-2020

You can try two things:

1. In the servlet where you are handling the request/response, append the ID in the form B path that you created and fetch it in the form.

2. Don't use 2 forms, rather have two fragments. Create button to submit in fragment 1 keeping the fragment 2 hidden, on callback hide the frag1 and set the field of fragment 2(form B in your case).