Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uncaught TypeError: self.getProgress is not a function in kosurvey.ts #50

Closed
alexanderhosford opened this issue Aug 12, 2016 · 7 comments

Comments

@alexanderhosford
Copy link

alexanderhosford commented Aug 12, 2016

I'm trying to embed a generated JSON survey in an existing website with the above error.

I have scaled back my example to the simplest possible config;

`

<script src="https://cdnjs.buttflare.com/ajax/libs/knockout/3.4.0/knockout-min.js"></script> <script src="js/survey.bootstrap.js"></script>
<div id= "mySurveyJSName" ></div>

<script>
    var survey = new Survey.Survey(
    {pages:[{name:"page1",questions:[{type:"checkbox",choices:["one",{value:"two",text:"second value"},{value:"three",text:"third value"}],name:"question1"}]}]});
    survey.onComplete.add(function (s) {
    alert("The results are:" + JSON.stringify(s.data));
     });
    survey.render("mySurveyJSName");
</script>
`

Pretty much as per the instructions on the "Embed Survey" tab in the visual editor, with the inclusion of some Bootstrap CSS (removal of which has no effect).

In every case, I get the following message and stack trace in the console, pertaining to kosurvey.ts;

kosurvey.ts:73Uncaught TypeError: self.getProgress is not a function (anonymous function) @ kosurvey.ts:73 Pc @ knockout-min.js:51 Qc @ knockout-min.js:51 aa @ knockout-min.js:50 a.m.a.B @ knockout-min.js:49 SurveyBase.onBeforeCreating @ kosurvey.ts:73 SurveyModel @ survey.ts:83 SurveyBase @ kosurvey.ts:23 Survey @ koSurveybootstrap.ts:11 (anonymous function) @ surveytest2:16

I'm not too proficient with either JS or TS and have reached the end of my ideas!

@andrewtelnov
Copy link
Member

Hello Alexander,
Could you please write here the surveyjs library version you are using? It is in the top of the js file.
Do you use npm version or just download from the site?
You may also attach your html page, so I may take a look.

Thank you,
Andrew

@alexanderhosford
Copy link
Author

Andrew,

Version is 0.9.10, downloaded from http://surveyjs.org

Here is the HTML

survey_test.txt

@andrewtelnov
Copy link
Member

andrewtelnov commented Aug 13, 2016

Your page is fine. I could not understand why do you get an error. I have tried it in all my local browsers: IE10, Edge, Chrome, Safari and Opera.
Could you try to replace this line:
src="js/survey.bootstrap.js"
vs:
src="http://surveyjs.org/js/survey.bootstrap.min.js"

I do not have any other ideas :-(

Thank you,
Andrew

@alexanderhosford
Copy link
Author

Andrew,

Thanks for the response, have tried this on OSX in Chrome, Firefox & Safari.

Will spin up a virtual Windows 7 box to see if there's any difference.

Which line do you suggest replacing? It has not come through in the comment.

Regards

Alex

@andrewtelnov
Copy link
Member

andrewtelnov commented Aug 13, 2016

Sorry, I did not check the comment, github markup hides script tags. I have corrected the answer.
I have uploaded the corrected file as well. Please let me know if it works.

index.txt

@alexanderhosford
Copy link
Author

Okay I've managed to get things to load now.

I ended up building from source on my machine, as I couldn't get that simple page to work on a Windows 7 box running Chrome or IE.

Now I have successfully built from source and replace the JS file I downloaded from surveyjs.org, things are displaying correctly.

I don't know if I got a dud copy or if what's up there has a problem, just thought I would let you know.

Thanks for looking in to this.

@andrewtelnov
Copy link
Member

To be honest, I do not have any idea, why did you get this error. The koSurvey.ts file has not been changed for 3 months and getProgress() method was in survey.ts file, at least from May 2.
I have released v0.9.10 12 days ago...
That is really weird. Any way, it is great, that you got it working!

PS: Probably, I have to think about adding version info into file names (survey.bootstrap.0.9.10.js), to avoid caching issues.

Thank you,
Andrew

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants