Hi,
I am using AEM 5.6.1
I need to modify the values of the attribute that get stored in the /content/usergenerated/ for the form fields that gets stored on form submit
I find that there is a server validation /apps/foundation/components/form/defaults/field/servervalidation.jsp. But i find i cannot use it to change the value attribute that could get stored under /content/usergenerated/
I tried the below /apps/foundation/components/form/defaults/field/servervalidation.jsp for "Country" field and changed the value of Country to cs but found that the value submitted using form got stored. please let me how this can be achieved.
for(final FieldDescription desc : descs) {
if ( FieldHelper.checkRequired(slingRequest, desc) ) {
FieldHelper.checkConstraint(slingRequest, slingResponse, desc);
}
if ( desc.isRequired()) {
String[] values = request.getParameterValues(desc.getName());
// You can check for length of values in the string array/values whatever
//suits you for required validation.
}
if(desc.getName().equalsIgnoreCase("Country")){
slingRequest.setAttribute("Country","cs");
}
}
Thanks
Views
Replies
Total Likes
Any inputs from anyone for the above will be helpfull??
Views
Replies
Total Likes
The client or server validation is used to generate a snippet of javascript that will be used on the front side to validate the entered value. Avoid misuse of it. You should implement custom action type & in post.POST.jsp handle the changes required. Out of the box location reference like /libs/foundation/components/form/actions/<actiontype>/post.POST.jsp
Views
Replies
Total Likes
Thanks Sham for the inputs.
I have custom form field name "email" i tried changing its value in forward.jsp
under the below path i the below jsps
/apps/app1/components/form/actions/store
/apps/app1/components/form/actions/store/addfields.jsp
/apps/app1/components/form/actions/store/forward.jsp
the above code is taken from /libs/foundation/components/form/actions/store
in the /apps/app1/components/form/actions/store/forward.jsp we have the existing code
try {
final Node node = JcrUtil.createPath(path, "sling:Folder", adminSession);
final Node parent = node.getParent();
node.setProperty("email","what@abc.com"); // i added the custom form field that i wanted to get stored under /content/usergenerated/path
but the email value was always overwritten with the actual value i had passed using form.
From the above could you please tell me as how could i set the "email" value to "what@abc.com" to be stored in /content/usergenerated/path
Thanks
Views
Replies
Total Likes
Views
Like
Replies