- Posts: 63
- Thank you received: 4
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
processString() doesn't recognize question value until you navigate past
- cheeseburger
- Topic Author
- Offline
- Senior Member
Less
More
2 years 9 months ago #217549
by cheeseburger
processString() doesn't recognize question value until you navigate past was created by cheeseburger
Hi. We are using processString() to print the value of a question to html text. The benefit of this is that it gives us the values in real-time and can see values when questions are not on the screen in a multipage survey. We've built an elaborate tool that requires this functionality but we will respectfully spare you from the long details. Please try to ignore the "why" for what we are trying to accomplish as we are attempting to understand the following behavior of how processString() works. Here are some details:
ProcessString works great for most of what we are attempting to accomplish.
The challenge we have is that if we have a user that saved and resumed a survey and they completed 5 out of 10 pages, processString will not connect to the question answers until we navigate passed the last question that has values.
In other words, if the user resumes the survey and begins at page one, processString can retrieve the values of question answers only that are on page one and cannot access the question answers of page 2,3,4, or 5.
However, If we advance to page 5, then processString will connect all of the answers from page 1 through page 5.
If we go back to page 1, now processString is connected to all of the questions up to page 5.
The observation is that it requires an initial navigation to page 5 for the questions on pages 1,2,3,4,5 to connect to the answers using processString().
If the answers are in the database from the last save/resume, why do they not display on page 1 without requiring the click forward to page 5 first?
Additional context if confusing: Imagine that we have a div on the left margin that displays the QID and its value for each of the questions in the survey that is written as html text. This content is available throughout the entire survey as we test this functionality. This left margin html text content will populate with the values pulled by processString().
Thanks for your help!
ProcessString works great for most of what we are attempting to accomplish.
The challenge we have is that if we have a user that saved and resumed a survey and they completed 5 out of 10 pages, processString will not connect to the question answers until we navigate passed the last question that has values.
In other words, if the user resumes the survey and begins at page one, processString can retrieve the values of question answers only that are on page one and cannot access the question answers of page 2,3,4, or 5.
However, If we advance to page 5, then processString will connect all of the answers from page 1 through page 5.
If we go back to page 1, now processString is connected to all of the questions up to page 5.
The observation is that it requires an initial navigation to page 5 for the questions on pages 1,2,3,4,5 to connect to the answers using processString().
If the answers are in the database from the last save/resume, why do they not display on page 1 without requiring the click forward to page 5 first?
Additional context if confusing: Imagine that we have a div on the left margin that displays the QID and its value for each of the questions in the survey that is written as html text. This content is available throughout the entire survey as we test this functionality. This left margin html text content will populate with the values pulled by processString().
Thanks for your help!
The topic has been locked.
- cheeseburger
- Topic Author
- Offline
- Senior Member
Less
More
- Posts: 63
- Thank you received: 4
2 years 9 months ago #217553
by cheeseburger
Replied by cheeseburger on topic processString() doesn't recognize question value until you navigate past
The topic has been locked.
- cheeseburger
- Topic Author
- Offline
- Senior Member
Less
More
- Posts: 63
- Thank you received: 4
2 years 9 months ago #217554
by cheeseburger
Replied by cheeseburger on topic processString() doesn't recognize question value until you navigate past
I've added this mockup to provide some additional context to my description. This mockup shows what it looks like on page one even though pages 2,3,4 and 5 have answers. But, if we use the skip feature (question index functionality) to skip to PAGE FIVE, and then go back to page one, all of the questions in the left hand dark gray bar will show values. Thanks
The topic has been locked.
- DenisChenu
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 13935
- Thank you received: 2551
2 years 9 months ago #217567
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 processString() doesn't recognize question value until you navigate past
I think you must report the issue.
In my opinion : it's related to this issue : bugs.limesurvey.org/view.php?id=16230
«16230: Reload survey (token answer persistence) don't really reload …»
When reloading : relevanceStatus is set to NULL if question is after current lastpage.
Because i need a solution (in 3.X) : i update reloadAnyResponse plugin : gitlab.com/SondagesPro/coreAndTools/relo...AnyResponse.php#L220 .
But have a cleaner solution is surely something to do.
In my opinion : it's related to this issue : bugs.limesurvey.org/view.php?id=16230
«16230: Reload survey (token answer persistence) don't really reload …»
When reloading : relevanceStatus is set to NULL if question is after current lastpage.
Because i need a solution (in 3.X) : i update reloadAnyResponse plugin : gitlab.com/SondagesPro/coreAndTools/relo...AnyResponse.php#L220 .
But have a cleaner solution is surely something to do.
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.
- tpartner
- Away
- LimeSurvey Community Team
Less
More
- Posts: 10632
- Thank you received: 3696
2 years 9 months ago - 2 years 9 months ago #217570
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 processString() doesn't recognize question value until you navigate past
A workaround might be to insert the question/answer list in the group description (using normal ExpressionScript) and place the group description in that left-hand div in the twig file.
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Last edit: 2 years 9 months ago by tpartner.
The topic has been locked.
- DenisChenu
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 13935
- Thank you received: 2551
2 years 9 months ago #217578
by DenisChenu
When reload submitted survey startpage is set to 1 : then relevanceStatus for question after is set to false
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 processString() doesn't recognize question value until you navigate past
Unsure it work with token answer persistence + reload allowed.A workaround might be to insert the question/answer list in the group description (using normal ExpressionScript) and place the group description in that left-hand div in the twig file.
When reload submitted survey startpage is set to 1 : then relevanceStatus for question after is set to false
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
2 years 9 months ago #217580
by cheeseburger
Replied by cheeseburger on topic processString() doesn't recognize question value until you navigate past
Thank you both for your responses. It seems that the Group Desc test follows the same challenges where it cannot access "future questions". A workaround has been for me to trigger a click equivalent to clicking to the last group (there are around 20 groups in this large survey). This accomplishes preloading the left side bar values but forces user to the end of the survey. So I'm considering making a faux preloader that appears as if the survey is loading while masking the automated clicks to the last question then back to the first question (I will ignore the fact that they saved and resumed and LS may want to take them to the question they left off on).
We do have token persistence and save/resume activated.
In this left side bar, not only does it display the values, but it also performs calculations and displays sums, it also includes SKIP TO functions like a table of contents, and since it is html text it allows us to get around some issues with SPANS being wrapped around retrieved values when on the same page as a field. We basically have EM and JS working together and when one cannot access values the other will compensate and vice versa.
Do you know of a section in the manual or dev docs that gives access to any callback functions? I may be able to get around some challenges if we are able to insert some actions in between orders of execution (without modifying the core).
Thanks!
We do have token persistence and save/resume activated.
In this left side bar, not only does it display the values, but it also performs calculations and displays sums, it also includes SKIP TO functions like a table of contents, and since it is html text it allows us to get around some issues with SPANS being wrapped around retrieved values when on the same page as a field. We basically have EM and JS working together and when one cannot access values the other will compensate and vice versa.
Do you know of a section in the manual or dev docs that gives access to any callback functions? I may be able to get around some challenges if we are able to insert some actions in between orders of execution (without modifying the core).
Thanks!
The topic has been locked.
- DenisChenu
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 13935
- Thank you received: 2551
2 years 9 months ago #217581
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 processString() doesn't recognize question value until you navigate past
Can you report the issue with the Group Desc part ?
Else : did you test with reloadAnyReponse and keepMaxStep activated (if you use 3.X) ?
Else : did you test with reloadAnyReponse and keepMaxStep activated (if you use 3.X) ?
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
2 years 9 months ago - 2 years 9 months ago #217583
by cheeseburger
Replied by cheeseburger on topic processString() doesn't recognize question value until you navigate past
We did the following in the last hour:
1. Reviewed the bug report and clicked through the two links you posted in 2021 and then attempted to read through the code to begin to understand which parts we need and if they are dependencies of each other.
2. We clicked through to the link you posted above for ( gitlab.com/SondagesPro/coreAndTools/relo...AnyResponse.php#L220 ) and realized THIS may be the singular file we need - so we installed this.
3. We went to the plugin configuration screen but the options confused us, so we then consulted the README in the git and are continuing to try to read through with our team to understand what the various options do, which need to be set for our needs, and are being cautious in case it does some things we may not intend for it to do. We also are trying to confirm that this plugin doesn't require additional dependencies such as "Token User Management" as referenced in the READ ME.
However, with the plugin activated and all settings set to default, we did test the survey to see if it was able to see "future questions" and it didn't work yet. We assume it requires more config changes.
We also saw a reference to possibly requiring the survey ID but continue to read through.
Note: We are using v3.x (sorry for neglecting to mention this sooner)
1. Reviewed the bug report and clicked through the two links you posted in 2021 and then attempted to read through the code to begin to understand which parts we need and if they are dependencies of each other.
2. We clicked through to the link you posted above for ( gitlab.com/SondagesPro/coreAndTools/relo...AnyResponse.php#L220 ) and realized THIS may be the singular file we need - so we installed this.
3. We went to the plugin configuration screen but the options confused us, so we then consulted the README in the git and are continuing to try to read through with our team to understand what the various options do, which need to be set for our needs, and are being cautious in case it does some things we may not intend for it to do. We also are trying to confirm that this plugin doesn't require additional dependencies such as "Token User Management" as referenced in the READ ME.
However, with the plugin activated and all settings set to default, we did test the survey to see if it was able to see "future questions" and it didn't work yet. We assume it requires more config changes.
We also saw a reference to possibly requiring the survey ID but continue to read through.
Note: We are using v3.x (sorry for neglecting to mention this sooner)
Last edit: 2 years 9 months ago by cheeseburger. Reason: added version
The topic has been locked.
- DenisChenu
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 13935
- Thank you received: 2551
2 years 9 months ago #217584
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 processString() doesn't recognize question value until you navigate past
Without updating plugin config : nothing change
Justa activate keepMaxStep
A question :
> The challenge we have is that if we have a user that saved and resumed a survey and they completed 5 out of 10 pages, processString will not connect to the question answers until we navigate passed the last question that has values.
You don't use token here ? Right ?
I think it work only for token enable survey (currently)
About 3 : yes , sorry … this plugin start to be really complex. I already split , but here need more update to have a more simple system …
Justa activate keepMaxStep
A question :
> The challenge we have is that if we have a user that saved and resumed a survey and they completed 5 out of 10 pages, processString will not connect to the question answers until we navigate passed the last question that has values.
You don't use token here ? Right ?
I think it work only for token enable survey (currently)
About 3 : yes , sorry … this plugin start to be really complex. I already split , but here need more update to have a more simple system …
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
2 years 9 months ago #217586
by cheeseburger
Replied by cheeseburger on topic processString() doesn't recognize question value until you navigate past
haha awesome, we will make that config change (thank you!).
We do use a token for this survey. During earlier previews while developing we turn it off but at this point we will leave the token functionality enabled to make sure it works with your plugin.
Complexity: That's how our tool has become. Way overly complex but necessary for the very specific requirements of the project and to workaround challenges with LS. But, your version of complexity is mind blowing (in a good way). Such power tools you continue to author. Thank you so much for doing this and for sharing them!
I'll give the config change a try now...
We do use a token for this survey. During earlier previews while developing we turn it off but at this point we will leave the token functionality enabled to make sure it works with your plugin.
Complexity: That's how our tool has become. Way overly complex but necessary for the very specific requirements of the project and to workaround challenges with LS. But, your version of complexity is mind blowing (in a good way). Such power tools you continue to author. Thank you so much for doing this and for sharing them!
I'll give the config change a try now...
The topic has been locked.
- cheeseburger
- Topic Author
- Offline
- Senior Member
Less
More
- Posts: 63
- Thank you received: 4
2 years 9 months ago #217587
by cheeseburger
Replied by cheeseburger on topic processString() doesn't recognize question value until you navigate past
Update: Since my last msg, we activate the YES for keepMaxStep...we believe we do that here "Keep max step during each load and save" and we check the box. We tried this with our current processString() code in that sidebar and we tried using straight EM in the group description. Unfortunately neither "looked ahead" to see the values, even though the save and resumed survey had actually gone to the end of the survey at one point.
The warning did scare us before checking the box "Warning : when set this by default : it update all current survey table" since we were concerned it could overwrite any values we had in place for our survey. We didn't notice anything yet though.
The warning did scare us before checking the box "Warning : when set this by default : it update all current survey table" since we were concerned it could overwrite any values we had in place for our survey. We didn't notice anything yet though.
The topic has been locked.