Retrieving data from custom service and displaying in aem adaptive forms

hari_purushotha 04-06-2018

Hi,

I am working on an adaptive form 6.3.

I am working on the scenario,

  1. where I have capture the user entered form data
  2. send it to the custom service
  3. After my business logic is done, I have to return some value back from my service back to the form and that value should be displayed to the user.

The first 2 steps, I have achieved it by writing custom submit action.But I don't have clue how to get back the value from service and display that in the adaptive form.

Can someone please guide me in that approach.

Regards,

Hari

Note:

I am using AEM repository for storing

Accepted Solutions (1)

Accepted Solutions (1)

Mayank_Gandhi
Employee
14-06-2018

Hi Hari,

Try using the guideBirdge API here, maybe you can set the id returned from your service in a form hidden field and on guideBridge.submit success, you may just show the field value in the js alert. Below is an approach that I tried :

guideBridge.submit({

  validate: false,

   error : function (guideResultObject) {//log something

   },

  success : function (guideResultObject) {alert(hidden_id.value);

  location.href = "http://www.example.com/ThankYou.html";

  }});

API reference : Adaptive Forms Class: GuideBridge

Thanks,

Mayank

Answers (5)

Answers (5)

hari_purushotha 14-06-2018

Hi Mayank,

Thanks for your reply..

On clicking of submit button from adaptive form-->A node will be created in the repository with unique ID-->The service will return the unique ID,which need to be displayed as "popup" to the user.

Service -

I am using sling.getservice to connect my service from post.POST.jsp

Form structure:      text field with submit button at the bottom

CRX: Form data are stored as individual node of type -->sling:folder

-Hari

Mayank_Gandhi
Employee
14-06-2018

Hi Hari,

Do you want to display the data returned from the service in the form itself or you want to have it some new page like a Thank you Page?

Please share details on service, form structure and how the data is residing currently in the crx?

-Mayank Gandhi