- Posts: 63
- Thank you received: 4
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
PJAX Perspective (configurations, container target, disable/enable, modify, etc)
- cheeseburger
- Topic Author
- Offline
- Senior Member
Less
More
3 years 2 months ago #210601
by cheeseburger
PJAX Perspective (configurations, container target, disable/enable, modify, etc) was created by cheeseburger
Hi, I searched for a few days and performed various tests but still am compelled to inquire with the group:
With regards to AJAX/PJAX usage in LS, what is the current status for the following?
Current version of LS: Version 3.25.7+210113
With regards to AJAX/PJAX usage in LS, what is the current status for the following?
- Is there no longer an option to choose to use or not use AJAX in multiscreen surveys? There used to be a slider for the setting or there was a value you could place in the theme options advanced text field.
- Does it by default now use PJAX always?
- What is the container (the unique selector in the DOM) used for PJAX to load the dynamic page-swapping contents?
- Can the container be modified (Can we limit it to a different unique selector)?
- When performing an order-of-execution test, I placed various console.log scripts to attempt to find areas of the DOM that remain after clicking NEXT in a multiscreen survey. However I was never able to find a location that wasn't replaced. I'm hopeful that knowing some more about the above items, will help inform this item. My goal is to be able to have AJAX/PJAX replace content traversing deeper into the DOM vs replacing the entire page contents.
Current version of LS: Version 3.25.7+210113
The topic has been locked.
- tpartner
- Away
- LimeSurvey Community Team
Less
More
- Posts: 10630
- Thank you received: 3696
3 years 2 months ago #210607
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 PJAX Perspective (configurations, container target, disable/enable, modify, etc)
AJAX/PJAX has been disabled - it caused far too many issues.
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The following user(s) said Thank You: DenisChenu
The topic has been locked.
- cheeseburger
- Topic Author
- Offline
- Senior Member
Less
More
- Posts: 63
- Thank you received: 4
3 years 2 months ago #210609
by cheeseburger
Replied by cheeseburger on topic PJAX Perspective (configurations, container target, disable/enable, modify, etc)
If we wanted to retain a value from question to question, what method does the community use? For example, if we had used AJAX, I would simply write to some JS vars outside of the container that AJAX would load the content into. I see we have the ability to use JS with each question if XSS is disabled but am trying to get around that as well as trying to find a solution without modifying any PHP files. Thanks for the update about AJAX/PJAX and appreciate any additional info.
One thing to note: I do see ajaxify and pjax still being loaded in my browser network inspector.
Thanks again!
One thing to note: I do see ajaxify and pjax still being loaded in my browser network inspector.
Thanks again!
The topic has been locked.
- tpartner
- Away
- LimeSurvey Community Team
Less
More
- Posts: 10630
- Thank you received: 3696
3 years 2 months ago #210611
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 PJAX Perspective (configurations, container target, disable/enable, modify, etc)
Can't you use Expression Manager to carry the values through the survey?
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
- cheeseburger
- Topic Author
- Offline
- Senior Member
Less
More
- Posts: 63
- Thank you received: 4
3 years 2 months ago #210612
by cheeseburger
Replied by cheeseburger on topic PJAX Perspective (configurations, container target, disable/enable, modify, etc)
I can utilize EM within a question's contents, inside of an equation type of question, and in the various sidebar validation/relevance fields. I believe I attempted to utilize it within the theme's code but had challenges (I will re-run a test and confirm).
For the current request from the client, the solution appears to be best if I can communicate between javascript and EM but I can't seem to perform that function without disabling XSS.
I can run some more tests in order to provide a more accurate definition of where the "walls" appear. And will try to spare you from the extraneous details of the end goal, but will also include that after I run some more tests. Thank you for you help.
For the current request from the client, the solution appears to be best if I can communicate between javascript and EM but I can't seem to perform that function without disabling XSS.
I can run some more tests in order to provide a more accurate definition of where the "walls" appear. And will try to spare you from the extraneous details of the end goal, but will also include that after I run some more tests. Thank you for you help.
The topic has been locked.
- tpartner
- Away
- LimeSurvey Community Team
Less
More
- Posts: 10630
- Thank you received: 3696
3 years 2 months ago #210613
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 PJAX Perspective (configurations, container target, disable/enable, modify, etc)
Where are you placing the JS?
If it's in custom.js, no, there is no access to EM.
If it's in a theme TWIG file, you can access EM variables with {{ processString('{EM_Variable}') }}.
For example:
If it's in custom.js, no, there is no access to EM.
If it's in a theme TWIG file, you can access EM variables with {{ processString('{EM_Variable}') }}.
For example:
Code:
<script type="text/javascript" charset="utf-8"> $(document).on('ready',function(){ console.log("Q1: {{ processString('{Q1_SQ001}') }}"); }); </script>
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
- cheeseburger
- Topic Author
- Offline
- Senior Member
Less
More
- Posts: 63
- Thank you received: 4
3 years 2 months ago #210614
by cheeseburger
Replied by cheeseburger on topic PJAX Perspective (configurations, container target, disable/enable, modify, etc)
This just turned my frown upside down! I will test this next. Thank you!
The topic has been locked.
- cheeseburger
- Topic Author
- Offline
- Senior Member
Less
More
- Posts: 63
- Thank you received: 4
3 years 2 months ago #210615
by cheeseburger
Replied by cheeseburger on topic PJAX Perspective (configurations, container target, disable/enable, modify, etc)
Quick thought: The challenge of having JS and EM communicate - and to be able to access fields is mostly likely solved by your wonderful tip. The remaining challenge is for me to retain a value (within a queue) to perform some calculations. If the entire page didn't refresh its contents, I would usually place global vars in a piece of the DOM that isnt replaced. Is the workaround, to create hidden questions and to store the values within them as if they were variables? Or is there a method to store them using EM? Thanks
The topic has been locked.
- tpartner
- Away
- LimeSurvey Community Team
Less
More
- Posts: 10630
- Thank you received: 3696
3 years 2 months ago #210616
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 PJAX Perspective (configurations, container target, disable/enable, modify, etc)
EM can only store variables in questions (hidden or not) - usually stored in equation type questions. So, if you can not access the value(s) directly from existing survey questions (as in my example), yes, you will need to use EM to load hidden questions.
Another tact I have taken to carry JS variables from page to page is to load them into browser local storage. Of course, this only works if the respondent stays in the same browser. I quite often use that trick to synchronize answer order in multiple questions with randomly shown answers, etc.
Another tact I have taken to carry JS variables from page to page is to load them into browser local storage. Of course, this only works if the respondent stays in the same browser. I quite often use that trick to synchronize answer order in multiple questions with randomly shown answers, etc.
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The following user(s) said Thank You: cheeseburger
The topic has been locked.
- DenisChenu
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 13935
- Thank you received: 2551
3 years 2 months ago #210623
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 PJAX Perspective (configurations, container target, disable/enable, modify, etc)
You can extend ExpresssionManager in 4.X version.
Adding function and variables are possible.
Adding function and variables are possible.
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.
- cheeseburger
- Topic Author
- Offline
- Senior Member
Less
More
- Posts: 63
- Thank you received: 4
3 years 2 months ago #210649
by cheeseburger
Replied by cheeseburger on topic PJAX Perspective (configurations, container target, disable/enable, modify, etc)
Oooh this is exciting! Looking fwd to when we upgrade to v4. Thanks to both of you for your help. I'll provide an update once I progress with your suggestions for future users to benefit as well. Thanks
The topic has been locked.
- cheeseburger
- Topic Author
- Offline
- Senior Member
Less
More
- Posts: 63
- Thank you received: 4
3 years 2 months ago #210660
by cheeseburger
Replied by cheeseburger on topic PJAX Perspective (configurations, container target, disable/enable, modify, etc)
Interesting observation: When using your (Tony's) method to access vals of a question from within a TWIG file, I do get the expected results until I am on the actual question. To clarify: I have three question groups. I am placing the question from which I want to get its value in the second of three groups (the middle). When I am on the first screen (group) or 3rd screen, the value displays as just the value. This is good. But when viewing the same code when I am actually on the second screen (second group) where the question is located, I receive the following:
<span id='LEMtailor_Q_94_2'>30</span>
Is this the standard behavior?
Thanks
<span id='LEMtailor_Q_94_2'>30</span>
Is this the standard behavior?
Thanks
The topic has been locked.