Closed xmichael closed 8 years ago
Update
Instead of receiving the external JSON as a URL, it should be passed to a function directly as an argument e.g.
initFromIP(json)
would initialize the survey using the aforementioned radio buttons directly from the json parameter.
Last tweaks based on last-minute feedback:
profiles[0]["url"]
and value "profile"
requirement[x]["required"]
for each controlThe above will be refactored in a more generic way only if there is an actual use-case or testbed to plan on.
above commit has been deployed
We were asked to provide a way for the following JSON to be used for the initialization of a survey. This will hopefully help in the brainstorming process of what comes next.
To implement this, one needs to work with the example bellow. It is essentially just an import of an external ad-hoc json to create a Survey Designer json:
The sample external JSON is as follows:
One should be able to load the above onto the survey designer as an optional GET request
profile
e.g.http://surveydesigner/url?profile=http%3A//somedomain.com/widget/someprofile
Which will be used to pre-initialize a COBWEB survey with the a radio button and couple of custom attributes as follows:
This example is all we have and given that there are no solid rules about how to generalize the above approach we can "guess" that we should always:
x
in the arrayrequirements
create a radio button with values fromrequirement[x]["entries"]["label"]
requirements[x]["entries"]["id"]
and valuerequirements["entries"]["label"]