Question T378
Visible to All Users

Uncaught type error t on clicking complete button

created 7 years ago

uncaught typeerror t is not a function

Screen+Shot+2018-01-17+at+11.30.24+AM.png

This error only happened when I load the survey in a modal window. I've search a bit and this is seem to be reactjs error. Is there any possibilities that a same function name is used in react too?

Answers

created 7 years ago

Hello,
It is impossible to say what is going on without seeing the code. Could you create a plunker example that produces this issue?

Thank you,
Andrew
SurveyJS Team

    Comments (2)

      Hi Andrew, sorry I’ve solve the issue. The problem was I’m using the JS and PHP curl to submit the result. Well the curl override the JS onComplete function, thus triggering the error.

      My sample code:

      JavaScript
      var surveyJSON = { surveyId: 'your-survey-id' } survey = new Survey.Model(surveyJSON); survey.surveyPostId = 'another-survey-id'; function sendDataToServer() { var resultAsString = JSON.stringify(survey.data); $.ajax({ type: "POST", url: "process-questionnaire.php", data: { "status": 'completed', "data": resultAsString }, success: function(msg) { alert("Thanks for participating."); $('#myModal').hide(); } }); } $("#surveyContainer").Survey({ model: survey, onComplete: sendDataToServer });

        I can't see anything wrong in your code.
        Could you please try the latest version of SurveyJS. We are using a knockout version for jQuery now, instead of react/preact in the previous.

        Thank you,
        Andrew
        SurveyJS Team