Writing a Custom Submit in AEM Forms

Quick and easy way to create your own custom submit action for Adaptive Form

This article will walk you through the steps needed to create a custom submit action for handling Adaptive Forms submission.

  • Login to crx
  • Create a node of type "sling :folder " under apps. Let’s call this node CustomSubmitHelpx.
  • Save the newly created node.
  • Add the following two properties to the newly created node
  • PropertyName | Property Value
  • guideComponentType | fd/af/components/guidesubmittype
  • guideDataModel | xfa,xsd,basic
  • jcr :description | CustomSubmitHelpx
  • Save the changes
  • Create a new file called post.POST.jsp under the CustomSubmitHelpx node.When an adaptive form is submitted, this JSP is called. You can write the JSP code as per your requirement in this file. The following code forwards the request to the servlet.
<%
%><%@include file="/libs/foundation/global.jsp?lang=en"%>
<%@taglib prefix="cq" uri="http://www.day.com/taglibs/cq/1.0"%>
<%@ page import="org.apache.sling.api.request.RequestParameter,com.day.cq.wcm.api.WCMMode,com.adobe.forms.common.submitutils.CustomParameterRequest,com.adobe.aemds.guide.submitutils.*" %>

<%@ page import="org.apache.sling.api.request.RequestParameter,com.day.cq.wcm.api.WCMMode" %>
<%@page session="false" %>
<%

   com.adobe.aemds.guide.utils.GuideSubmitUtils.setForwardPath(slingRequest,"/bin/storeafsubmission",null,null);

%>
  • Create file called addfields .jsp under the CustomSubmitHelpx node. This file will enable you to access the signed document.
  • Add the following code to this file

    <%@include file="/libs/fd/af/components/guidesglobal.jsp?lang=en"%>

    <%@page import="org.slf4j.LoggerFactory" %>

    <%@page import="org.slf4j.Logger" %>

    <input type="hidden" id="useSignedPdf" name="_useSignedPdf" value=""/>;

  • Save your changes

Now you will start seeing “CustomSubmitHelpx” in the submit actions of your Adaptive Form as shown in this image.

Adaptive Form with Custom Submit

On this page

Adobe Summit Banner

A virtual event April 27-28.

Expand your skills and get inspired.

Register for free
Adobe Summit Banner

A virtual event April 27-28.

Expand your skills and get inspired.

Register for free
Adobe Maker Awards Banner

Time to shine!

Apply now for the 2021 Adobe Experience Maker Awards.

Apply now
Adobe Maker Awards Banner

Time to shine!

Apply now for the 2021 Adobe Experience Maker Awards.

Apply now