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
  • cheeseburger's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
3 years 2 months ago #210614 by cheeseburger
This just turned my frown upside down! I will test this next. Thank you!
The topic has been locked.
  • cheeseburger
  • cheeseburger's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
3 years 2 months ago #210615 by cheeseburger
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
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 2 months ago #210616 by tpartner
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.

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
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 2 months ago #210623 by DenisChenu
You can extend ExpresssionManager in 4.X version.
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
  • cheeseburger's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
3 years 2 months ago #210649 by cheeseburger
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
  • cheeseburger's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
3 years 2 months ago #210660 by cheeseburger
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
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 2 months ago #210662 by tpartner
Yes, if you explore the source for a normally inserted expression for a question on the same page, you would see the same <span> element. I have no clue why that span is inserted.

Possible solution - twig.readthedocs.io/en/latest/filters/striptags.html

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
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 2 months ago #210667 by DenisChenu

tpartner wrote: Yes, if you explore the source for a normally inserted expression for a question on the same page, you would see the same <span> element. I have no clue why that span is inserted.

To be updated by javascript.
Since it's the same page : you need a way for Expression to update value. And the best way is to add an id to the element :)

tpartner wrote: Possible solution - twig.readthedocs.io/en/latest/filters/striptags.html

No : if you use TWIG : see ProcessString function

Then : you  can call (for sample)
{{ processString("{Q1.NAOK}}",1) }}

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
  • cheeseburger's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
3 years 2 months ago #210685 by cheeseburger
My next question may seem weird, but the answer may help me be empowered to better discover the types of solutions you have proposed on my own, and eliminate me from having to bug you haha: I've spent a substantial amount of time reading through the various LS docs (current/old/and some that I found that seem to be for the future). I've searched through info related to themes/EM/dev/plugin dev/etc. I've also read through any related TWIG docs, bootstrap, etc. Finally, I've traced numerous processes through the raw PHP files - and of course searched the forums.

Recently, after seeing the "processString" suggestion, I searched for that and found one instance under a subset of themes (in the docs). After the second suggestion for "striptags", I revisited the TWIG docs.

Do you have any particular URLs that may be a better point of reference for me to better research and find my solutions? Or am I already in the correct locations?

Something as simple as adding the "striptags" filter within the line

console.log("Q1: {{ processString('{Q1_SQ001}') }}");

Is a challenge since the order of {{ }} seems to be different in this context vs in the TWIG docs.

And as soon as I see something like "processString", my brain asks "now how did he know that was a possibility? Where did he learn/find this?"

If you have any specific links to docs that may be different than what I've found, that would be greatly appreciated. Perhaps once I see the solution to how to implement the filter into the processString syntax, that will begin to reveal the connection between the info in the TWIG docs vs EM.

Thanks for all of your help.
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 2 months ago - 3 years 2 months ago #210690 by DenisChenu
All twig part and theme part need better documentation …

For QuestionTheme (for example) : my documentation is tparner repos : github.com/tpartner?tab=repositories for example …
For specific twig function : github.com/LimeSurvey/LimeSurvey/blob/ma...S_Twig_Extension.php

Create documentatoon are really needed, but make plugin for my part) give money to buy sandwich (and home …) … not documentation ,

 [EDIT]
Hey : manual.limesurvey.org/Theme:Available_function

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.
Last edit: 3 years 2 months ago by DenisChenu. Reason: EZDIT
The topic has been locked.
  • cheeseburger
  • cheeseburger's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
3 years 2 months ago #210708 by cheeseburger
hahaha thank you DenisChenu - I love sandwiches as well hahaha
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 2 months ago #210712 by tpartner

Then : you can call (for sample)
{{ processString("{Q1.NAOK}}",1) }}

All twig part and theme part need better documentation …

Yes, we desperately need documentation for the custom themes, including functions available in the TWIG files.

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