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
4 years 7 months ago - 4 years 7 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 : www.limesurvey.org/manual/Theme:Available_function

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member. - Professional support - Plugins, theme and development .
I don't answer to private message.
Last edit: 4 years 7 months ago by DenisChenu. Reason: EZDIT
The topic has been locked.
More
4 years 7 months ago #210708 by cheeseburger
hahaha thank you DenisChenu - I love sandwiches as well hahaha
The topic has been locked.
More
4 years 7 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.
More
4 years 7 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 www.limesurvey.org/manual/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 support - Plugins, theme and development .
I don't answer to private message.
The topic has been locked.
More
4 years 7 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.
More
4 years 7 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 - www.limesurvey.org/manual/ExpressionScri..._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.
More
4 years 7 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.
More
4 years 7 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.
More
4 years 7 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.
More
4 years 7 months ago - 4 years 7 months ago #210919 by DenisChenu
> Something like this works for me, but it is only applied when a page is submitted. yes : because Expression manager happen before twig Quickly
:-
  • index (check survey, token etc …)
  • Create or find survey session
  • Use surey session for EM session
  • POST action- End Expression
  • Start twig part
  • display twig
Suremly lack of some part here …

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member. - Professional support - Plugins, theme and development .
I don't answer to private message.
Last edit: 4 years 7 months ago by DenisChenu.
The topic has been locked.
More
4 years 7 months ago - 4 years 7 months ago #210920 by cheeseburger
Tony: I think your answer made it all click. The order of execution is such that the TWIG file needs to parse the STRING in order to pass the syntax to be understood and parsed as an Expression. Writing {Q1 = "A3"} works fine within the context of a question, but for LS to understand it as an Expression from within a TWIG file, we utilize the processString() method for both SETTING and GETTING.

Note: My test using your code actually did parse without hitting submit.

Also worth noting: earlier in the thread, I had noted that when GETTING the val of a question when I was on the same page as that question, it added additional markup around the value. This is no longer the case for some unknown reason. I haven't updated anything but it stopped behaving that way for dozens of runs since noting it.

Thank you for all of your help. I believe this will conclude this thread.

Denis: I saw your post after posting my response to Tony and you further confirmed my understanding. Thank you as well! 
Last edit: 4 years 7 months ago by cheeseburger. Reason: I needed to include Denis haha.
The topic has been locked.
Moderators: holchtpartner

Lime-years ahead

Online-surveys for every purse and purpose