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)

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

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

We have manual.limesurvey.org/Theme:Available_function for function (and how to adding).
But : no real place for Theme management and edition …

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 #210850 by cheeseburger
I'm tempted to start a new topic but want to leverage the context of what we've been discussing: So far, we've been exploring GETTING values. Is it possible to SET a value of a question (short text field type) from within a hybrid Javascript/Expression Manager block? I had seen in other posts where you explain how to simply update the value of a field and then you trigger a keyup event to render the value to the DB. Does this remain *the* method to perform a SET? (example below)

$("#answer{SGQ}").val(whatiwant).trigger('keyup');

Thanks
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 2 months ago #210852 by tpartner
JavaScript:

The keyup event fires Expression manager, it does not save to the database, that is only done when submitting the page.

The JS varies substantially depending on question type.

Expression Manager:

Set a question - manual.limesurvey.org/ExpressionScript_-..._assignment_operator

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.
  • cheeseburger
  • cheeseburger's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
3 years 2 months ago #210853 by cheeseburger
Oh great! So this is exactly the way I would assign a value when creating expressions from within the control panel. I will run some tests for this from the TWIG files now. Thanks!
The topic has been locked.
  • cheeseburger
  • cheeseburger's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
3 years 2 months ago #210913 by cheeseburger
Update for SETTING a value from within a TWIG file:

Using JS with the following syntax worked fine:
$("#answer415748X21X94").val('someValue').trigger('keyup');

I am now attempting to update the same question (short text type) value without JS and just by using EM. However no matter what the syntax is that I use, I am not having success.

I tried various methods that work if I am using EM within the control panel's Question field or within the Relevance field. But there must be a small syntax difference when working within the TWIG file.

Do you have a sample of a simple SET expression that would work from within a TWIG file? I don't require a condition, but if needed, we can say if not blank. The Question ID is 'Q2', its a short text type and can accept any value (not locked to numeric only). Hoping your answer provides the final revelation needed to break through into the more complex places I am taking this once this small step is accomplished.

Thanks!
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 2 months ago #210916 by tpartner
Something like this works for me, but it is only applied when a page is submitted.
 
 
Code:
{{ processString('{Q1 = "A3"}') }}

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.

Lime-years ahead

Online-surveys for every purse and purpose