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
I added the below configs in the submit section.
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
This throws a 500 error on the page.
Please let me know if I am missing any configurations for the submit action to work on a servlet
Solved! Go to Solution.
Topics help categorize Community content and increase your ability to discover relevant content.
Views
Replies
Total Likes
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
Views
Replies
Total Likes
Can you please refer to the link below for the same:
Hope this helps.
Views
Replies
Total Likes
Views
Replies
Total Likes
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
Views
Replies
Total Likes
I tried to get the names, it comes as empty. I enabled the logs on AEM, I see the following entry. Not sure if we need to specifically mention the encoding type anywhere in the forms.
com.adobe.aemds.guide.service.impl.RESTSubmitActionService RESTSubmitActionService: Content type is either is null or does not contain application/x-www-form-urlencoded
Views
Replies
Total Likes
Can you please check if the servlet resolver is resolving correctly to your servlet path
also can you please paste your servlet code?
Views
Replies
Total Likes
okay, the problem was my tomcat server was not configured to accept the multiform data. Now I am getting the values back into my servlet. However, it is coming as "jcr:data" and "dataXml" with identical content
"<afData><afUnboundData><data><username>testing user</username><password>testing password</password></data></afUnboundData><afBoundData><data xmlns:xfa="http://www.xfa.org/schema/xfa-data/1.0/"/></afBoundData><afSubmissionInfo><computedMetaInfo/><signer...>"
Is there any OOTB configuration which can transform to a normal HTTP POST request that can be retrieved by request.getParameter("username") ? Or this has to be a custom submit action to send the values to be servlet in that format?
Views
Replies
Total Likes
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
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies