Execute CQ form actions with ajax | Community
Skip to main content
New Participant
October 16, 2015
Solved

Execute CQ form actions with ajax

  • October 16, 2015
  • 5 replies
  • 2722 views

Hi All , 

 I have a custom form action nodes which has a forward.jsp via which the control is forwarded to my custom servlet . All this happens when the form start component is configured to execute the custom action . 

Now I want to achieve this behaviour  in ajax way  . In normal cases where I am not using cq form actions , I can add my js to a html and on submit execute a url to a servlet . With cq form actions how i can make a call to action's forward.jsp in ajax way ?

 

Thanks in advance

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 Sham_HC

Take a look at [1] & will meet your need. 

[1]  http://adobe-consulting-services.github.io/acs-aem-commons/features/ajax-component.html

5 replies

Sham_HC
Sham_HCAccepted solution
New Participant
October 16, 2015
smacdonald2008
New Participant
October 16, 2015

Here is a community article that talks about submitting data from a web page to an AEM Sling Servlet using AJAX:

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

KrisgumAuthor
New Participant
October 16, 2015

Hi ,

   Thanks for your replies . I can see how acs bundle ajaxes the components but i'm not sure how I can  make it fit to my requirement . As i had mentioned before and aas also mentioned in smacdonald post , i can directly call my servlet in ajax script and make it work  , but if i choose to use CQ form actions this approach wouldn't work . 

When using CQ form actions in formstart component , slingpostservlet is executed which redirects to formaction node and executes either forward.jsp or post.Post.jsp . I'm not able to figure out how acs commons base ajax component approach can be made fit here ? Any pointers ? 

 

Thanks in advance

 

 

Sham_HC
New Participant
October 16, 2015

I thaught you are looking to pull data into the page via AJAX.   If your request forward to servlet & from there make ajax request does not make sense because servlet is server side & why you want to make a ajax request there. Because ajax is client side.  Am i missing something here?

KrisgumAuthor
New Participant
October 16, 2015

Hi Sham ,

 I'm infact trying to pull data via ajax , but I want to do it via cq form actions . I have some custom CQ form actions which actually pull data from external sources . I have my from start component which are configured to execute these actions on submit . 

Now I want to achieve the same behaviour of executing CQ form actions via ajax   , I just select the action in form start component and on submit the form should be submitted asynchronously . I have already achieved this by bypassing cq formactions and directly executing servlet by passing servlet path as url in ajax script .

 

regards