guideBridge API to prefill adaptive form with json | Community
Skip to main content
Level 4
May 16, 2018

guideBridge API to prefill adaptive form with json

  • May 16, 2018
  • 1 reply
  • 4078 views

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.

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

1 reply

nalla0109Author
Level 4
May 17, 2018

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 6
May 18, 2018

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

nalla0109Author
Level 4
June 1, 2018

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.