Expand my Community achievements bar.

Enhance your AEM Assets & Boost Your Development: [AEM Gems | June 19, 2024] Improving the Developer Experience with New APIs and Events

AEMaaCS - Forms submit to an AEM servlet -401 unauthorized

Avatar

Level 10

Hi

Was trying form , on click of submit to AEM servlet - a POST , say at /bin/x path or res type and it throws a 401 (due to permissions is what I gather , how do I set it ?) . 

has anyone done this for CORE form components ? I don’t want to use a data model. 

Steps for the same would be appreciated 

thanks in advance 

 

6 Replies

Avatar

Employee Advisor

So you have a core component based AF and you want to make a post call to a servlet on the click of a button?

 

Avatar

Level 10

hi @workflowuser yes perhaps on click of submit at the end of the form have a post to the backend . I found an alternative way to do which is JS for massaging json in the file before sending to backend system via rules and js (globals export) . But I am clueless how I can get to the backend via restful service option within AEM submit button 

core components submit button 

Avatar

Employee Advisor

you will need to write a custom submit handler to handle to form submission. In the custom submit handler write your logic to handle the submission

The following article should help you

https://experienceleague.adobe.com/en/docs/experience-manager-learn/cloud-service/forms/custom-submi...

Avatar

Level 10

Thank you @workflowuser , I cannot use the api unless I build with different archetype. Is there an alternate way ? I know of submit script via rule for submit btn but I was looking for the rest submit that connects to backend for post .

 

Avatar

Administrator

@NitroHazeDev Did you find the suggestion helpful? Please let us know if you require more information. Otherwise, please mark the answer as correct for posterity. If you've discovered a solution yourself, we would appreciate it if you could share it with the community. Thank you!  



Kautuk Sahni