On form submission getting the following error: javax.jcr.nodetype.ConstraintViolationException: No matching property definition: txn_type = PP | Community
Skip to main content
Level 2
October 16, 2015
Solved

On form submission getting the following error: javax.jcr.nodetype.ConstraintViolationException: No matching property definition: txn_type = PP

  • October 16, 2015
  • 3 replies
  • 1903 views

Hi,

I've my form as something like this:

t1.jsp:

<%@include file="/libs/foundation/global.jsp"%>
<%@page session="false" %>
<%@ page language="java" %>

<form name="frm" method="POST" id="frm" action="<%=resource.getPath()%>.html">
    <div>Enter your name<input type="text" name="nameX"/></div>
<input type="submit" name="submit" value="test"/>
</form>

 

POST.jsp:

<%@include file="/libs/foundation/global.jsp"%>
<%@ page session="false"%>
<%
String transaction_type = request.getParameter("namex");
log.info("teststttttt"+transaction_type);
%>

 

 

 

I'm getting error:

*ERROR* [127.0.0.1 [1437981615101] POST /content/abc/en/t1.html HTTP/1.1] org.apache.sling.servlets.post.impl.operations.ModifyOperation Exception during response processing.
javax.jcr.nodetype.ConstraintViolationException: No matching property definition: nameX = kjkjkjkj

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by smacdonald2008

When posting data from an HTML form to AEM - post the data to  a Sling Servlet using AJAX. See this community article:

https://helpx.adobe.com/experience-manager/using/custom-sling-servlets.html

You have much better control over how to process data by writing app logic in the Slign Servlet. IN this example - the posted data is encoded to JSON using the Simple JSON API. 

3 replies

Level 2
October 16, 2015

Thanks Scott,

I have already did that and it worked very smoothly that way, but don't we have any simpler way to submit forms to a jsp file in CQ?

E.g. Suppose if my form is like <form action="submit_form.jsp" method="post">

then this won't work in case of adobe CQ, I just want to post all data of my form to second page and if I use servlets, then it would be bit lengthier to get the data first and then arrange it in proper format and send back to second page.

smacdonald2008
smacdonald2008Accepted solution
Level 10
October 16, 2015

When posting data from an HTML form to AEM - post the data to  a Sling Servlet using AJAX. See this community article:

https://helpx.adobe.com/experience-manager/using/custom-sling-servlets.html

You have much better control over how to process data by writing app logic in the Slign Servlet. IN this example - the posted data is encoded to JSON using the Simple JSON API. 

Level 2
June 13, 2020

I am facing a similar issue when I am trying to submit my AMP(Accelerated Mobile Page) form.Please find the following link of the raised issue below and provide a solution if anyone has worked with AMP forms in AEM.

https://experienceleaguecommunities.adobe.com/t5/adobe-experience-platform/amp-accelerated-mobile-page-form-support-in-aem/qaq-p/366536