Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.
SOLVED

Can we pass the AEM form object values to another AEM form ?

Avatar

Level 2

Can we pass the AEM form object values(eg: entered in textfield) to another AEM form . Please provide an example

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Dear Jadish,

 

We are very lucky to work on the fantastic AEM Forms framework build by Adobe!

 

Dear Adobe has number of wonderful API's that let us deliver such asks!

 

You may need to write a short script set on Root Panel. where you listen on:

 

guideBridge.on('elementNavigationChanged', function(event, payload) {

//here we can listen for our payload or select element you may wish to select and set

localStorage.setItem('myCustomValue', value)

}

 

Then once you load the other form you may wish to load the value on 

$( document ).ready(function () {

localStorage.getItem('myCustomValue');

})

 

[1] Docs AEM forms * JavaScript Examples (adobe.com)

 

Kindest Regards,

Peter

View solution in original post

2 Replies

Avatar

Correct answer by
Community Advisor

Dear Jadish,

 

We are very lucky to work on the fantastic AEM Forms framework build by Adobe!

 

Dear Adobe has number of wonderful API's that let us deliver such asks!

 

You may need to write a short script set on Root Panel. where you listen on:

 

guideBridge.on('elementNavigationChanged', function(event, payload) {

//here we can listen for our payload or select element you may wish to select and set

localStorage.setItem('myCustomValue', value)

}

 

Then once you load the other form you may wish to load the value on 

$( document ).ready(function () {

localStorage.getItem('myCustomValue');

})

 

[1] Docs AEM forms * JavaScript Examples (adobe.com)

 

Kindest Regards,

Peter

Avatar

Community Advisor

Hi @JADISH 

 

There are various ways you can pass the values entered in text field from one form to another. One approach is already explained by @Peter_Puzanovs, here are the other approaches-

 

1. Submit to REST endpoint submit option passes the data filled in the form to a configured confirmation page as part of the HTTP GET request. You can add the name of the fields to request. The format of the request is:

{fieldName}={request parameter name}

AvinashGupta01_0-1671997262234.png

You can then retrieve the parameter value on the second form like:-

String data= request.getParameter("param1");

 

Here are the details for using Submit to REST endpoint : https://experienceleague.adobe.com/docs/experience-manager-65/forms/adaptive-forms-basic-authoring/c... 

 

2. You can use browser cookie to save the parameter value in the first form and retrieve values on the other form. Cookie can store maximum size of 4096 bytes.

 

Hope this helps.