Unable to read the response back when using submit action in AEM forms

rohitn62196663

02-05-2018

I am trying to submit the entire form data using the submit action in AEM forms. I have my own custom submit action which is built on top of the OOTB "sumit to REST endpoint" action. So I am able to hit the end point which I configured within the submit action but I am unable to read the response back to UI. I dont want to redirect it to another thank you page. My app is a single page application so I just want to write the response back to UI so that I can read the response. I have gone through the adobe docs and my code is below:

guideBridge.registerConfig("submitConfig", {"useAjax" : true});

guideBridge.submit({

  validate: false,

  error : function (guideResultObject) {console.log("error occured");},

  success : function (guideResultObject) {console.log("success occured");

}

});

But I am unable to read the response the end point is writing back to my custom action. All I see in the "guideResultObject" is

"{"thankYouOption":"page","thankYouContent":"<currentpageUrl>/jcr:content/guideContainer.guideThankYouPage.html?owner=admin&status=Submitted"}", status: "Submitted"}

I think there are some internal GuideSubmitServlet scripts which are intercepting the request and adding these params to the response. Is there a way to stop this and send the my custom response back to UI ?

Thanks in advance.

Accepted Solutions (0)

Answers (5)

Answers (5)

rohitn62196663

02-05-2018

yup I see that code snippet in the OOTB action too. However even after that it didn't remove the params. And also I am not sure from where this TYoption and TYpagecontent is coming in the params.

I am trying to see if there are any methods in GuideUtils class which would help me with this.

smacdonald2008

02-05-2018

Checking with the Form team to see if we have any example of this use case. We have use cases on custom actions and handling form data in an OSGi bundle - but not writing out the submitted form back on the original form.