Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

guideBridge API to prefill adaptive form with json

rohitn62196663
Level 4
Level 4

I am trying to prefill an adaptive form with json which is as per the json schema which I used to create the form. For testing purpose I have create a mock prefill data in the json format in a file and I am able to read that json and prefill form using the below guideBridge api:

guideBridge.restoreGuideState({

     dataRef : "file:///C:/Users/prefill.json",

     success: function(guideResultObject){

    console.log("prefill success");

     },

     error : function (guideResultObject) {

    console.log("prefill error");

     }

});

But in my use case I will be getting the json from a rest url and we need to send post some params to get that data. So I wrote an ajax call to get the jsonresponse. So Is there a way to include the jsonObject itself within the guideBridge.restoreGuideState api to prefill the data ? I have looked into the guidebridge documentation but didn't find anything related to this use case.

3 Replies
rohitn62196663
Level 4
Level 4

Any update on this query please ?

In the dataRef itself I can include a rest endpoint but even for that I need to post some params to get the response back. Is there a way to do that ?

James_R_Green
Level 7
Level 7

guideBridge.restoreGuideState({

                guideState : response.guideState,

                error : function (guideResultObject) {

                    console.log('failed', guideResultObject);

                }

            });

My reply on the following post might help as a full example

https://forums.adobe.com/message/10202335

rohitn62196663
Level 4
Level 4

Thanks for the reply. In your example, the json which we get is the entire form guideState object. But in my case the JSON object should be in the format of the datamodel which i configured initially with the form. It should have the bound and unbound tags. In that way it will be prefilled automatically without writing the custom script. The dataRef url which I posted in the question gives me the json in that format itself. So I am checking to see if there is a way to pass that json to guideBridge.restoreguidestate function so that it will be prefilled.

I cant directly metion the url in the dataref itself because to that url (rest endpoint) I need to post params which I dont think it's possible with guideBridge.restoreguidestate function.