Unable to submit AEM adaptive form to internal servlet from local author instance

Avatar

Avatar

priyadarshi_cts

Avatar

priyadarshi_cts

priyadarshi_cts

14-05-2020

Hi,

 

I am trying to submit an adaptive form with three fields to an internal servlet /bin/sling/adaptiveformssubmit

 

I followed the steps here and created the below configs

 

priyadarshi_cts_0-1589458877027.png    priyadarshi_cts_1-1589458984765.png  

I added the below configs in the submit section.

priyadarshi_cts_2-1589459083175.png

I always get the default message "Thank you for submitting the form." and the form data does not reach the back end servlet.

This is my post.POST.jsp

 

<%@include file="/libs/fd/af/components/guidesglobal.jsp" %>
<%@page import="org.apache.sling.api.resource.ResourceUtil,
com.adobe.cq.social.commons.CollabUtil,
org.apache.sling.jcr.api.SlingRepository,
org.apache.sling.api.resource.ValueMap,
java.util.concurrent.atomic.AtomicInteger,
org.slf4j.Logger,
org.slf4j.LoggerFactory,
org.apache.sling.jcr.base.util.AccessControlUtil,
org.apache.jackrabbit.api.security.user.UserManager,
com.adobe.aemds.guide.service.GuideStoreContentSubmission,
javax.jcr.security.Privilege,
java.util.HashMap,
javax.jcr.Session,
javax.jcr.Node,
javax.jcr.security.AccessControlList,
javax.jcr.security.AccessControlPolicyIterator,
javax.jcr.security.AccessControlManager,
javax.jcr.security.AccessControlPolicy,
com.day.cq.commons.jcr.JcrUtil,
com.adobe.aemds.guide.servlet.GuideSubmitServlet,
com.adobe.aemds.guide.utils.GuideConstants,
com.day.cq.wcm.foundation.forms.FormsHelper" %>
<%@ page import="org.apache.commons.lang3.StringUtils" %>

<% final AtomicInteger uniqueIdCounter = new AtomicInteger();

%>
<%@taglib prefix="sling" uri="http://sling.apache.org/taglibs/sling/1.0" %>
<%
%>
<%@taglib prefix="cq" uri="http://www.day.com/taglibs/cq/1.0" %>
<cq:defineObjects/><sling:defineObjects/>
<%
log.info("Inside Contact Us!");
FormsHelper.runAction("/bin/sling/adaptiveformssubmit", "post", resource,
slingRequest, slingResponse);
//GuideSubmitServlet.setForwardPath(slingRequest, "/bin/sling/adaptiveformssubmit", null, null);

%>

I have also tried to directly link the servlet as a REST Endpoint like below 

priyadarshi_cts_3-1589459388439.png

This throws a 500 error on the page.

priyadarshi_cts_4-1589459478457.png

Please let me know if I am missing any configurations for the submit action to work on a servlet

Adaptive Forms AEM 6.4.7

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar

GirishBedekar

Avatar

GirishBedekar

GirishBedekar

25-05-2020

you will have to parse the submitted data as xml in your servlet which handles the form submission and then fetch the appropriate elements value using xpath or org.w3c.dom.Document methods 

Answers (3)

Answers (3)

Avatar

Avatar

GirishBedekar

Avatar

GirishBedekar

GirishBedekar

25-05-2020

Can you please check if the servlet resolver is resolving correctly to your servlet path

also can you please paste your servlet code?

 

Avatar

Avatar

GirishBedekar

Avatar

GirishBedekar

GirishBedekar

21-05-2020

Can you please enumerate through all the request parameters and write the parameter names to the log file

use request.getParameterNames and the. Loop through the enumeration 

I think you will find a request parameter called jcr:data which will have the data submitted 

Avatar

Avatar

MayankTiwari

Avatar

MayankTiwari

MayankTiwari

20-05-2020

Can you please refer to the link below for the same:

https://docs.adobe.com/content/help/en/experience-manager-learn/forms/handling-af-form-submissions/s....

 

Hope this helps.