I want to validate a user sign-up form when the entire form is submitted. Un-like most of the OOB form components, I want my error message to show at the top of the form not at the position of the component. After some reading, I am thinking maybe using the Form-Global Constraints by setting the Validation Resource Type path (http://dev.day.com/docs/en/cq/current/developing/developing-forms.html).
I have created a folder called validation in /apps/myApps/forms. I have created a JSP called servervalidation.jsp in the folder and I have added the following code:
<%@page session="false" %><%
%><%@taglib prefix="sling" uri="http://sling.apache.org/taglibs/sling/1.0" %><%
ValidationInfo.addConstraintError(slingRequest, "ERROR ERROR ERROR ERROR ERROR ERROR ERROR ERROR ERROR ERROR ERROR ERROR");
However, whenever I submit a form, no validation happens and the form just submits and redirects to the thank you page.
What am I doing wrong?
In start of the form , advanced tab specify Validation Resource Type pointing to your defined resource Ex:- /apps/myApps/forms
I'm having a similar problem. Did you ever resolve this?
update - I managed to call the server side script by explicitly defining it in the Validation Resource Type field on the form dialog i.e. /apps/myapp/components/form/validation/servervalidation.jsp