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

SOLVED

Retrieving data from custom service and displaying in aem adaptive forms

hari_purushotha
Level 2
Level 2

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

1 Accepted Solution
Mayank_Gandhi
Correct answer by
Community Advisor
Community Advisor

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

View solution in original post

6 Replies
Mayank_Gandhi
Community Advisor
Community Advisor

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

smacdonald2008
Level 10
Level 10

Sounds like Prepopulating Form with Service data - do we have docs for this?

hari_purushotha
Level 2
Level 2

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
Correct answer by
Community Advisor
Community Advisor

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

View solution in original post

Mayank_Gandhi
Community Advisor
Community Advisor

Hi Hari,

Any updates on this?