Expand my Community achievements bar.

Learn about Edge Delivery Services in upcoming GEM session

Get formData of Adaptive Form Fragment

Avatar

Level 1

Hi,

My requirement is that I have AEM Form with wizard layout and I have dropped multiple AF fragments in that form with each panel having a submit button. Now on each click, I want to get that particular AF fragment data and submit it to back-end but currently unsuccessful. I tried using guideBridge.getDataXML() but it seems to give me data for every panel currently in the form. I am assuming getDataXML implementation is like something this; returns data based on the values saved in DOM rather than guideBridge Object itself!!

Is there any way I can pull Data from each panel on click of submit button using functions/implementations provided by AEM?

8 Replies

Avatar

Employee Advisor

Why do you have submit on each panel? Are all these independent of each other?

If you want to extract data from a particular fragment bind the form to a schema in a data model and then call the guideBridge data xml over it. Parse the xml and you know already which is the parent node for each panel so you can parse the xml and separate out data based on the panel.

Thanks!

Mayank

Avatar

Level 1

Assume a long form which is subdivided into sub-forms, when each sub-form is filled user clicks on the submit button and moves to next sub-form. In my case, each sub-form is AF Fragment which I dropped in form having wizard layout.

Can I extract Data without binding AF fragments to an XML schema?

Avatar

Employee Advisor

Even in case of long form you should have a save button on each panel and single submit for the form at the last panel.

Avatar

Level 1

I have a requirement where I have to submit data of every sub-form in the back-end, that's why I was calling it a submit button.

Anyway, is there a way I can do it without binding it to XML schema?

Although, I have written a logic to pull data from every panel by using its somExpression and pulling value from guideObject. It working fine. I just want to confirm that can I achieve the same by any feature provided by AEM itself?

Avatar

Employee Advisor

Out of the box I don't think so. Somewhere you will have to implement a custom approach and your logic also seem fine.

"I have written a logic to pull data from every panel by using its somExpression and pulling value from guideObject"

Avatar

Employee Advisor

No worries, If I am able to get some more solution I will let you know.

Have a great day!

Avatar

Employee Advisor

Why not save the complete json.

guideBridge.getGuideState({
     success : function (guideResultObj) {
         var json = guideResultObj.data;
         //post the JSON to a server that saves it at say http://abc.com/my/data.json
     },
     error : function (guideResultObj) {
      // log error
     }
});