Highlighted

Get formData of Adaptive Form Fragment

Avatar

Avatar

Vabs95

Avatar

Vabs95

Vabs95

09-07-2019

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?

Replies

Highlighted

Avatar

Avatar

Mayank_Gandhi

Employee

Avatar

Mayank_Gandhi

Employee

Mayank_Gandhi
Employee

09-07-2019

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

Highlighted

Avatar

Avatar

Vabs95

Avatar

Vabs95

Vabs95

09-07-2019

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?

Highlighted

Avatar

Avatar

Mayank_Gandhi

Employee

Avatar

Mayank_Gandhi

Employee

Mayank_Gandhi
Employee

09-07-2019

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.

Highlighted

Avatar

Avatar

Mayank_Gandhi

Employee

Avatar

Mayank_Gandhi

Employee

Mayank_Gandhi
Employee

09-07-2019

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
     }
});

Highlighted

Avatar

Avatar

Vabs95

Avatar

Vabs95

Vabs95

09-07-2019

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?

Highlighted

Avatar

Avatar

Mayank_Gandhi

Employee

Avatar

Mayank_Gandhi

Employee

Mayank_Gandhi
Employee

09-07-2019

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"

Highlighted

Avatar

Avatar

Vabs95

Avatar

Vabs95

Vabs95

09-07-2019

Thanks, Mayank Gandhi​ I guess I have to go with my logic then.

Highlighted

Avatar

Avatar

Mayank_Gandhi

Employee

Avatar

Mayank_Gandhi

Employee

Mayank_Gandhi
Employee

09-07-2019

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

Have a great day!