Hi all,
I am trying to create a function using GuideBridge API to populate the fields in an adaptive form from the response of an API, which gives me a key value pair where, the key matches the element name of the form field. I am trying to write a common function where multiple teams can use it without modifying the function. Any inputs would be appreciated.
Thanks,
Deepak
Solved! Go to Solution.
Views
Replies
Total Likes
Yes, you can restore the state with an XML source as well.
guideBridge.getData({
success : function (guideResultObj) {
var data = guideResultObj.data;
//post the data to a server that saves it at say http://abc.com/my/data.xml
//or http://abc.com/my/data.json
},
error : function (guideResultObj) {
// log the errors
}
});
// after some time or on click of a button or reloading the page
guideBridge.restoreGuideState({
dataRef : "http://abc.com/my/data.xml",
error : function (guideResultObject) {
// log the errors
}
})
Views
Replies
Total Likes
The title and the summary talk about two different scenarios, if we go with the summary then you need a few essential things:
1. All the forms need to follow some kind of naming convention for element Names.
2. All the elements you try to set must exist in the form.
3. Call the service to load the data and on success callback do the set value of the fields using the guideBridge.resolveNode("elementName").value
If we go with the title:
Adaptive Form can be restored in three ways
Example:
var jsonData
guideBridge.getGuideState({
success : function (guideResultObj) {
jsonData = guideResultObj.data;
},
error : function (guideResultObj) {
// log error
}
});
// after some time or on click of a button or reloading the page
guideBridge.restoreGuideState({
data : jsonData
error : function (guideResultObject) {
// log the errors
}
})
Thanks,
Mayank
Can the dataref be set to an xml source and populate the fields without reloading the form?
Views
Replies
Total Likes
Yes, you can restore the state with an XML source as well.
guideBridge.getData({
success : function (guideResultObj) {
var data = guideResultObj.data;
//post the data to a server that saves it at say http://abc.com/my/data.xml
//or http://abc.com/my/data.json
},
error : function (guideResultObj) {
// log the errors
}
});
// after some time or on click of a button or reloading the page
guideBridge.restoreGuideState({
dataRef : "http://abc.com/my/data.xml",
error : function (guideResultObject) {
// log the errors
}
})
Views
Replies
Total Likes