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
BedrockMission!

Learn More

View all

Sign in to view all badges

Resetting the guidestate of the form using a response from a webservice.

Avatar

Avatar
Validate 10
Level 3
deepakt84913413
Level 3

Likes

6 likes

Total Posts

71 posts

Correct Reply

1 solution
Top badges earned
Validate 10
Validate 1
Boost 5
Boost 3
Boost 1
View profile

Avatar
Validate 10
Level 3
deepakt84913413
Level 3

Likes

6 likes

Total Posts

71 posts

Correct Reply

1 solution
Top badges earned
Validate 10
Validate 1
Boost 5
Boost 3
Boost 1
View profile
deepakt84913413
Level 3

12-02-2019

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

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Springboard
Level 10
Mayank_Gandhi
Level 10

Likes

316 likes

Total Posts

1,139 posts

Correct Reply

184 solutions
Top badges earned
Springboard
Establish
Validate 1
Contributor 2
Ignite 5
View profile

Avatar
Springboard
Level 10
Mayank_Gandhi
Level 10

Likes

316 likes

Total Posts

1,139 posts

Correct Reply

184 solutions
Top badges earned
Springboard
Establish
Validate 1
Contributor 2
Ignite 5
View profile
Mayank_Gandhi
Level 10

15-02-2019

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

Answers (2)

Answers (2)

Avatar

Avatar
Springboard
Level 10
Mayank_Gandhi
Level 10

Likes

316 likes

Total Posts

1,139 posts

Correct Reply

184 solutions
Top badges earned
Springboard
Establish
Validate 1
Contributor 2
Ignite 5
View profile

Avatar
Springboard
Level 10
Mayank_Gandhi
Level 10

Likes

316 likes

Total Posts

1,139 posts

Correct Reply

184 solutions
Top badges earned
Springboard
Establish
Validate 1
Contributor 2
Ignite 5
View profile
Mayank_Gandhi
Level 10

12-02-2019

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

  • by passing the JSON data obtained from GuideBridge#getGuideState. This can be done by setting data property
  • by passing a URL pointing to a resource that returns XML that should be used. This can be done by setting dataRefproperty. The XML can be obtained by calling the getDataXML API.
  • by passing a URL point to a resource that returns JSON data obtained from GuideBridge#getGuideState. This can be done by setting guideStatePathRef property

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

Avatar

Avatar
Validate 10
Level 3
deepakt84913413
Level 3

Likes

6 likes

Total Posts

71 posts

Correct Reply

1 solution
Top badges earned
Validate 10
Validate 1
Boost 5
Boost 3
Boost 1
View profile

Avatar
Validate 10
Level 3
deepakt84913413
Level 3

Likes

6 likes

Total Posts

71 posts

Correct Reply

1 solution
Top badges earned
Validate 10
Validate 1
Boost 5
Boost 3
Boost 1
View profile
deepakt84913413
Level 3

12-02-2019

Can the dataref be set to an xml source and populate the fields without reloading the form?