Question

I have dragged the predefined Form component in my page.

enter image description here

I want to configure this form component i.e. by default it's points to itself, and data goes in BulkEditor. I want my data to be submitted to my own servlet. So how do I make the action="/MyServlet"

I also want to include my .js validation on this page, I tried using this link http://www.sfu.ca/itservices/cms/howto/advanced/style-a-page/customjavascript.html but I just don't have the option of adding .js in my page properties, why?

Was it helpful?

Solution

CQ5 forms are submited into actions. In order to submit your form into a custom action you need to create an action resource type:

-Create a sling:Folder with a prop sling:resourceType= foundation/components/form/action

Then you create a script or servlet for that resourceType that respond to POST methods and the post selector. This can be a jsp post.Post.jsp or a serlvlet (method=POST, selectors=post, extension=html).

To create a custom validation, you create a clientvalidation.jsp file under that same resourceType.

After that, you can edit your form and select your action.

Adobe documentation about it is pretty straighforward

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top