Expand my Community achievements bar.

Learn about Edge Delivery Services in upcoming GEM session
SOLVED

Core Form Container Submit -Post Form Data

Avatar

Level 6

Hi Team,

 

AEM Version: 6.5.11

 

Core component version: 2.17.12

 

We are building a simple form using Form Container and core components like Form Text, Form Submit etc.

 

arvind_0-1652873092160.png

 

Within Form Container we put Form Text, Form button as Submit.

 

Problem Statement: Now when we click on submit button, It does not post/call that  API url. No call in network tab.

arvind_1-1652873313730.png

 

 

Question: How does it work? Some configuration is needed ?

or this is just dialog support and rest all JS/server side code to be written manually?

 

 

 

 

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hi @arvind,

This is correct behavior. You will not see direct request to external API. In general this is how the request flow looks like OOTB for Post form data option and external endpoint.

  1. Form submit is handled by FormActionRpcServlet
  2. FormActionRcpServlet transforms data from form into JSON format and pass it to FormHandlerImpl service.
  3. FromHandlerImpl service uses Apache Http Client to send the data (in JSON format) to endpoint configured in Core From Container component.

Communication with endpoint happens behind the scene in backend (this is why you are not seeing call to API url in network tab in browser). OOTB form container is not supporting ajax calls - so every time you submit form page will be reloaded.

Please explore/debug, below classes to get full understanding or in case of troubleshooting:

View solution in original post

2 Replies

Avatar

Community Advisor

Hi,

Please check

https://experienceleague.adobe.com/docs/experience-manager-core-components/using/components/forms/fo...

https://github.com/adobe/aem-core-wcm-components/blob/72ee9a869c51deb4e5d2a5c1ec5b60c5579b2f68/conte...

 

It creates form element that mensa when you click on submit then a post request will be made.

can you check the generated html if that have all the attribute of form?



Arun Patidar

Avatar

Correct answer by
Community Advisor

Hi @arvind,

This is correct behavior. You will not see direct request to external API. In general this is how the request flow looks like OOTB for Post form data option and external endpoint.

  1. Form submit is handled by FormActionRpcServlet
  2. FormActionRcpServlet transforms data from form into JSON format and pass it to FormHandlerImpl service.
  3. FromHandlerImpl service uses Apache Http Client to send the data (in JSON format) to endpoint configured in Core From Container component.

Communication with endpoint happens behind the scene in backend (this is why you are not seeing call to API url in network tab in browser). OOTB form container is not supporting ajax calls - so every time you submit form page will be reloaded.

Please explore/debug, below classes to get full understanding or in case of troubleshooting: