Can we pass the AEM form object values to another AEM form ? | Community
Skip to main content
Level 2
December 22, 2022
Solved

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

  • December 22, 2022
  • 2 replies
  • 1002 views

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

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Peter_Puzanovs

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

2 replies

Peter_Puzanovs
Community Advisor
Peter_PuzanovsCommunity AdvisorAccepted solution
Community Advisor
December 22, 2022

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

Avinash_Gupta_
Community Advisor and Adobe Champion
Community Advisor and Adobe Champion
December 25, 2022

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}

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/configuring-submit-actions.html?lang=en 

 

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.