Question T13016
Visible to All Users

How can we trigger on change expression of ConfigureVariables in survey js?

created 2 years ago

This is the live example, I have tried. Its working on add question etc but didn't worked on change of expression.
I want to trigger this function on change expression.

Code
creator.saveSurveyFunc = function (saveNo, callback{         alert(JSON.stringify(creator.text))         callback(saveNo, true);       }

Example:
Plunker - Add nonItemValue property (plnkr.co)

Comments (1)
B B
Basic Home Loans 2 years ago

    this is in relation to Question T13002. sorry we posted a new question.

    the change of expression is not triggering saveSurveyFunc. only add is triggering the save func.

    Answers approved by surveyjs Support

    created 2 years ago

    Hello,
    You need to add the following code to make sure that your object has a link to survey:

    Code
    creator.onSurveyInstanceCreated.add((sender, options) => {   if(options.reason === "designer" || options.reason === "test") {     const survey = options.survey;     survey.createNewArray("configureVariables"(value) => {       value.setOwner(survey);     });   } }); //Recreate the designer survey creator.JSON = {};

    Here is the updated example.

    Thank you,
    Andrew
    SurveyJS Team