I have created a custom form action which contains the following: dialog, addfields.jsp, forward.jsp.
I am using the add fields.jsp to construct a simple form and a submit button.
My intention is that when the user submits, to form data is sent to another component where i invoke a service and then change the display with the result of the service.
I have tried using post.POST.jsp to handle the form data, and this works as expected, but forward.jsp gives me a blank screen. I am suing the example in
/libs/foundation/components/form/actions/mail
as suggested by this document [http://docs.adobe.com/docs/en/cq/current/developing/developing-forms.html]
Could you please explain how i should use the forward.jp functionality correctly.
Many Thanks
Solved! Go to Solution.
Views
Replies
Total Likes
Ok - this use case would require that functionality. You followed these docs:
http://helpx.adobe.com/marketing-cloud/experience-manager.html
and got an error. That should not have happened. Please file an AEM ticket here:
http://helpx.adobe.com/marketing-cloud/experience-manager.html
Views
Replies
Total Likes
You can use AJAX to submit data from a form to a custom Sling Servlet. Once you get the request to the servlet - you have more control over what happens. You can invoke other AEM services, you can encode the data (ie - into JSON), you can invoke an AEM workflow, you can write data to the JCR. You have more more control over the logic than using forward.jsp.
See: http://helpx.adobe.com/experience-manager/using/custom-sling-servlets.html
Views
Replies
Total Likes
I have tried writing the tutorial you suggested, and the ajax method works well, But its not what I'm trying to achieve.
This is an order form which redirects to a confirmation page on submit. The confirmation page calls an email service which builds templates and emails the appropriate people. The page also displays a summary of the total order and collection times.
To me this seems the a perfect scenario for forward.jsp, since all i want to do is make my form data accessible on the confirmation.jp where I call my service and print the confirmation.
My understanding was that the forward.jsp makes the form data available to the specified document.
(Simplified version of my code)
form:
<form name="orderForm" id="orderForm" action="#" method="post" class="form__parent validate-form"> <label class="form__label"> <span>Name</span> <input type="text" name="name" placeholder="Name*" class="form__input" tabindex="1" required> </label> <form>
forward.jsp:
<%@page session="false" %><% %><%@page import="com.day.cq.wcm.foundation.forms.FormsHelper"%><% %><%@taglib prefix="sling" uri="http://sling.apache.org/taglibs/sling/1.0" %><% %> <%@page import="com.day.cq.wcm.foundation.forms.FormsConstants"%> <sling:defineObjects/> <% FormsHelper.setForwardPath(slingRequest, "/my/path/to/page/with/confirmation/component"); FormsHelper.setRedirectToReferrer(request, true); %>
confirmation component:
<%@include file="/libs/foundation/global.jsp"%> <%@page session="false" %> <cq:includeClientLib categories="granite.utils" /> <cq:defineObjects/> <sling:defineObjects/> <% String name = request.getParameter("name"); %>
This is producing the following error
Status | 500 |
Message | javax.jcr.nodetype.ConstraintViolationException: No matching property definition: name = dane |
Location | /content/en/online-orders/order-confirmation |
Parent Location | /content/en/online-orders |
Path | /content/en/online-orders/order-confirmation |
Referer | http://localhost:4502/content/en/tester.html?cq_ck=1417598847156&status=500&status=500 |
ChangeLog | <pre></pre> |
Views
Replies
Total Likes
Ok - this use case would require that functionality. You followed these docs:
http://helpx.adobe.com/marketing-cloud/experience-manager.html
and got an error. That should not have happened. Please file an AEM ticket here:
http://helpx.adobe.com/marketing-cloud/experience-manager.html
Views
Replies
Total Likes