[Ticket cloned from T4563: I would like to trigger an event after click the delete button]
Hello Team
I am retreiving this type of JSON {"type":"text","name":"question1","QuestionID":49} from data database, I would like to create a page with this type of JSON
EX: {"type":"text","name":"question1","QuestionID":49}
{"type":"text","name":"question1","QuestionID":49}
{"type":"text","name":"question1","QuestionID":49}
NB if you have three object as mention below, I would like to have three question on the page1. how do I do that?
On 6/30/2020 12:53 PM, Serge T [surveyjs Support] wrote:
Sorry, could you please describe your task more?
Do you want to create it in SurveyJS Creator or SurveyJS Library (runner)?
Why can't you use
creator.JSON = myJSON;
orvar survey = new Survey(myJSON)
;In general, the code for creating a new question from JSON and add it into the current page should be the following.
For Library:
var question = Survey.Serializer.createClass(yourJSON.name); question.fromJSON(yourJSON); survey.currentPage.addQuestion(question);
For creator:
var question = Survey.Serializer.createClass(yourJSON.name); question.fromJSON(yourJSON); creator.survey.currentPage.addQuestion(question);
Thank you,
Andrew
SurveyJS Team