- Posts: 19
- Thank you received: 0
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
Problem while loading external javascript file
- NeoFlex
- Topic Author
- Offline
- New Member
Less
More
3 years 8 months ago #203113
by NeoFlex
Problem while loading external javascript file was created by NeoFlex
Hello,
In my survey, I load an external Java script file with each question group. I use this to access the slider in my three sub-questions that make up my question in each group. I have now found that my script file does not always load or run when I start the survey in the preview. I first thought this was a caching issue, so I added a query string to the script URL. But nothing happened. It's just not possible for me to find the mistake. So i ask here. Maybe you have an idea.
I attached an lss file.
In my survey, I load an external Java script file with each question group. I use this to access the slider in my three sub-questions that make up my question in each group. I have now found that my script file does not always load or run when I start the survey in the preview. I first thought this was a caching issue, so I added a query string to the script URL. But nothing happened. It's just not possible for me to find the mistake. So i ask here. Maybe you have an idea.
I attached an lss file.
Attachments:
The topic has been locked.
- holch
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 11639
- Thank you received: 2737
3 years 8 months ago #203115
by holch
I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.
Replied by holch on topic Problem while loading external javascript file
Are you testing the whole questionnaire, the question group or the question?
I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.
The topic has been locked.
- NeoFlex
- Topic Author
- Offline
- New Member
Less
More
- Posts: 19
- Thank you received: 0
3 years 8 months ago #203128
by NeoFlex
Replied by NeoFlex on topic Problem while loading external javascript file
I have this problem only when i test the whole survey.
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10099
- Thank you received: 3589
3 years 8 months ago #203150
by tpartner
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Replied by tpartner on topic Problem while loading external javascript file
I don't understand why you are creating and inserting the script element via jQuery. Why not insert it directly with a <script> tag?
I'm also not sure why you are inserting the custom.css file via jQuery. It should already be loaded and this will not update the assets cache.
Code:
<script type="text/javascript" src="https://pathTo/lsScript.js"></script>
I'm also not sure why you are inserting the custom.css file via jQuery. It should already be loaded and this will not update the assets cache.
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
- NeoFlex
- Topic Author
- Offline
- New Member
Less
More
- Posts: 19
- Thank you received: 0
3 years 8 months ago #203292
by NeoFlex
Replied by NeoFlex on topic Problem while loading external javascript file
Because I want to make sure that the script element is loaded and executed with every newly displayed question group. The same applies to the css file. Also there I want to make sure that the custom.css is loaded and overwrites the defaults.
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10099
- Thank you received: 3589
3 years 8 months ago - 3 years 8 months ago #203315
by tpartner
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Replied by tpartner on topic Problem while loading external javascript file
Placing my snippet in the group description will load the remote JS file.Because I want to make sure that the script element is loaded and executed with every newly displayed question group.
The theme custom.css file is already automatically loaded.Also there I want to make sure that the custom.css is loaded and overwrites the defaults.
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Last edit: 3 years 8 months ago by tpartner.
The topic has been locked.
- NeoFlex
- Topic Author
- Offline
- New Member
Less
More
- Posts: 19
- Thank you received: 0
3 years 8 months ago #203337
by NeoFlex
Replied by NeoFlex on topic Problem while loading external javascript file
Like I already wrote. If I embed the script this way, it won't load or run every time the question group is displayed. I checked that with a small console output that I integrated into the remote script. The problem then unfortunately remained with my current approach. Therefore my message in the forum. Maybe it's because I'm accessing the slider objects to change their properties. I deactivated that function and it worked so far.
I have already seen that custom.css is always loaded last. But also here I have the problem that the defaults are not overwritten with the setups in custom especially on the sliders.
I have already seen that custom.css is always loaded last. But also here I have the problem that the defaults are not overwritten with the setups in custom especially on the sliders.
The topic has been locked.
- DenisChenu
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 13597
- Thank you received: 2487
3 years 8 months ago #203338
by DenisChenu
Theme system sometimes load theme.css after custom.css … or core css
See bugs.limesurvey.org/view.php?id=14090 for example
In Skelvanilla : i load in it twig : gitlab.com/SondagesPro/SurveyThemes/skel...ws/header/theme.twig not by option …
Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
Replied by DenisChenu on topic Problem while loading external javascript file
Yes …but …tpartner wrote:
The theme custom.css file is already automatically loaded.Also there I want to make sure that the custom.css is loaded and overwrites the defaults.
Theme system sometimes load theme.css after custom.css … or core css
See bugs.limesurvey.org/view.php?id=14090 for example
In Skelvanilla : i load in it twig : gitlab.com/SondagesPro/SurveyThemes/skel...ws/header/theme.twig not by option …
Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
The topic has been locked.
- NeoFlex
- Topic Author
- Offline
- New Member
Less
More
- Posts: 19
- Thank you received: 0
3 years 8 months ago #203344
by NeoFlex
Replied by NeoFlex on topic Problem while loading external javascript file
Interesting....so maybe this bug still exist in 3.15.1+181017.
The topic has been locked.