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)

More
2 years 2 months ago #210601 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?
  • 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. 
Thanks for your help!

Current version of LS: Version 3.25.7+210113
The topic has been locked.
More
2 years 2 months ago #210607 by tpartner
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.
More
2 years 2 months ago #210609 by cheeseburger
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!
The topic has been locked.
More
2 years 2 months ago #210611 by tpartner
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.
More
2 years 2 months ago #210612 by cheeseburger
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.
The topic has been locked.
More
2 years 2 months ago #210613 by tpartner
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:

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.

Lime-years ahead

Online-surveys for every purse and purpose