How can i upload custom JS files to the Library so that they can be referred to the survey | XM Community
Question

How can i upload custom JS files to the Library so that they can be referred to the survey

  • 2 September 2019
  • 9 replies
  • 319 views

When i tried to upload my JS File to the files Library, it shows me error. Please let us know if i need to refer to a JS file in our survey for any custom solution then how i can achieve this?

the ERROR which is got is -> "The file you have uploaded is a disallowed file type."

which seems it doesn't allows JS files to upload in Files Library.

Using external reference is not a good idea since those reference can be deleted/blocked anytime. We can't take that risk.

9 replies

Userlevel 4
Badge +18
I believe Qualtrics don't let js file to be uploaded so better approach would be to paste all your codes\\functions in survey header.
This is really bad. so if i need to create a custom set up then i need to paste all of my code in survey itselelf. Could you please explain more regarding survey Header? how i can do that.
Userlevel 4
Badge +18
Anything you put in survey header becomes available for all questions in survey. So you can put your code there. Here is the link describing survey header:-

https://www.qualtrics.com/support/survey-platform/survey-module/look-feel/advanced-look-feel-settings/
Thanks for your help. This can work. I will try this.

But this approach is not suitable. Suppose if we are handling multiple custom set- ups in a complex survey and for one set-up we need to refer Jquery 1.8 and for the another set up we need Jquery 1.9 then this can cause problems since on the same page we are referring two libraries and the custom set-up may fail. :(

I am not sure if Qualtrics can be used efficiently for Custom set-ups or not.
Userlevel 4
Badge +18
In that case I would suggest to put library references on question level instead of theme level.
Library references - could you please explain? Library do not allowed JS files. then how can i refer Question level? Do you mean to say referring through HTML view? Please suggest.
Userlevel 4
Badge +18
Yes, by using script tag in HTML directly.
that;s not a good idea. I already tried that, if you have big JS Code in your file and you paste that code in HTML view then it behaves strange and the survey designer got hangs..

Its good for short code but not for heavy JS set-up. So as per this discussion it seems like Qualtrics can't handle JS files easily.
Looks like you can change the "js" extension to "txt" to upload. Once in the library, rename it to change back to "js" if you want. Either way, Library treats it as text, but your HTML can reference it as script.

Leave a Reply