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.
Views
Replies
Total Likes
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 ?
Views
Replies
Total Likes
guideBridge.restoreGuideState({
guideState : response.guideState,
error : function (guideResultObject) {
console.log('failed', guideResultObject);
}
});
My reply on the following post might help as a full example
Views
Replies
Total Likes
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.
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies