- Posts: 18
- Thank you received: 4
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
Logic not working in custom theme - JavaScript error in survey_runtime.js
- domsson
- Topic Author
- Offline
- New Member
Less
More
5 years 4 months ago #178396
by domsson
Logic not working in custom theme - JavaScript error in survey_runtime.js was created by domsson
I'm creating a theme that inherits from Vanilla. I've performed quite some changes (mainly throwing stuff out left and right, see my other threads). Now I just noticed that somehow, when using my theme, the survey logic doesn't work properly anymore. Comparing vanilla and my theme, I noticed that when using mine, the following can be seen on the JS console whenever survey logic failed:
This seems to stem from this piece of code in survey_runtime.js, function checkconditions():
I assume the "console.ls.error()" is causing the error, it should probably be "console.error"? In any case, the only reason we see this problem is because the try-catch failed. Which hints that ExprMgr_process_relevance_and_tailoring() failed. I assume this is the core of the issue.
Now I'm trying to figure out why this is failing. I understand that it is probably very hard, if not impossible, to point out the issue without having access to the system/theme. Still, maybe someone who understand the whole JS pipeline somewhat better might have an idea of what markup-changes could potentially cause this?
I'm grateful for any input. Thank you.
Code:
jquery-3.1.1.min.js:2 Uncaught TypeError: Cannot read property 'error' of undefined at checkconditions (survey_runtime.js:129) at HTMLDocument.<anonymous> (survey_runtime.js:23) at HTMLDocument.dispatch (jquery-3.1.1.min.js:3) at HTMLDocument.q.handle (jquery-3.1.1.min.js:3) at Object.trigger (jquery-3.1.1.min.js:4) at a.fn.init.triggerHandler (jquery-3.1.1.min.js:4) at HTMLDocument.<anonymous> (jquery-migrate-3.0.0.min.js:2) at j (jquery-3.1.1.min.js:2) at k (jquery-3.1.1.min.js:2)
This seems to stem from this piece of code in survey_runtime.js, function checkconditions():
Code:
try{ ExprMgr_process_relevance_and_tailoring(evt_type,name,type); } catch(e) { console.ls.error(e); }
I assume the "console.ls.error()" is causing the error, it should probably be "console.error"? In any case, the only reason we see this problem is because the try-catch failed. Which hints that ExprMgr_process_relevance_and_tailoring() failed. I assume this is the core of the issue.
Now I'm trying to figure out why this is failing. I understand that it is probably very hard, if not impossible, to point out the issue without having access to the system/theme. Still, maybe someone who understand the whole JS pipeline somewhat better might have an idea of what markup-changes could potentially cause this?
I'm grateful for any input. Thank you.
The topic has been locked.
- domsson
- Topic Author
- Offline
- New Member
Less
More
- Posts: 18
- Thank you received: 4
5 years 4 months ago #178402
by domsson
Replied by domsson on topic Logic not working in custom theme - JavaScript error in survey_runtime.js
One more addition: on every survey page (*before* the logic fails), this error can be observed:
Which stems from this code:
Code:
Uncaught TypeError: $(...).tooltip is not a function at HTMLDocument.<anonymous> (expression.js:6) at HTMLDocument.dispatch (jquery-3.1.1.min.js:3) at HTMLDocument.q.handle (jquery-3.1.1.min.js:3) at Object.trigger (jquery-3.1.1.min.js:4) at a.fn.init.triggerHandler (jquery-3.1.1.min.js:4) at HTMLDocument.<anonymous> (jquery-migrate-3.0.0.min.js:2) at j (jquery-3.1.1.min.js:2) at k (jquery-3.1.1.min.js:2)
Which stems from this code:
Code:
$(document).on('ready pjax:scriptcomplete', function(){ // Tooltip inside em-var $(".em-expression").tooltip(); });
The topic has been locked.
- domsson
- Topic Author
- Offline
- New Member
Less
More
- Posts: 18
- Thank you received: 4
5 years 4 months ago - 5 years 4 months ago #178404
by domsson
Replied by domsson on topic Logic not working in custom theme - JavaScript error in survey_runtime.js
After 6 hours of this, I gave up. I brought back ALL of the JavaScripts I had previously <remove>d via config.xml. All of them. I tried to figure out which one was responsible for the issue, but could not pinpoint it. The $().tooltip error was due to bootstrap not being included (don't ask me which of the THREE bootstrap JavaScript files). At this point, I can only assume that there are plenty of dependencies between the different JavaScript files and removing one puts you at danger of breaking everything.
I hate the architecture of this. Seriously. There is no separation of presentation of logic. There are inline-styles. There are so many JavaScripts frameworks and files and inline-code that even with a month of time on my hands, I wouldn't figure out what's what.
Sorry for the rant, but this is madness.
I hate the architecture of this. Seriously. There is no separation of presentation of logic. There are inline-styles. There are so many JavaScripts frameworks and files and inline-code that even with a month of time on my hands, I wouldn't figure out what's what.
Sorry for the rant, but this is madness.
Last edit: 5 years 4 months ago by domsson.
The topic has been locked.
- DenisChenu
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 13647
- Thank you received: 2491
5 years 4 months ago #178405
by DenisChenu
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 Logic not working in custom theme - JavaScript error in survey_runtime.js
About the 1st one : i think console.ls is part of
github.com/LimeSurvey/LimeSurvey/blob/ma...lslog/build/lslog.js
If not loaded : maybe an issue (to be reported)
About the second one : it's because you are admin connected : github.com/LimeSurvey/LimeSurvey/blob/ma.../admin/expression.js
Seems there are an issue too here , but i think i's because you don't have boostrap loaded ?
If not loaded : maybe an issue (to be reported)
About the second one : it's because you are admin connected : github.com/LimeSurvey/LimeSurvey/blob/ma.../admin/expression.js
Seems there are an issue too here , but i think i's because you don't have boostrap loaded ?
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 following user(s) said Thank You: domsson
The topic has been locked.