Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

Prefilling answers on repeat submissions

  • blocka
  • blocka's Avatar Topic Author
  • Offline
  • Platinum Member
  • Platinum Member
More
6 years 3 months ago #161909 by blocka
I have an open public survey with the first group of questions being contact details (name, phone number, address).

Respondents will be completing the survey multiple times. At the completion of the first submission, I want to give them the option to repeat the survey again. So, in the end message, I have a link that says "Complete the survey again".

The link contains a flag to indicate it is a repeat submission, and I'm passing the contact details in parameters (so the participant doesn't need to enter this information again). I'm using the panel integration to map the URL parameters to the target questions.

The first parameter is "HideOrg". On the question group containing contact details, I have a relevance equation to hide the group if HideOrg=Y.

In testing, after the first submission, the contact questions are passed to the new survey submission -- yay!

The Contact question group is hidden, because the group relevance question returns 1 for relevance question ((is_empty(HideOrg.NAOK) or HideOrg.NAOK != "Y"))

I proceed to complete the survey, and then I discover that the contact values haven't been stored with the survey.

If I remove the relevance equation so that the organization fields are shown, then the contact values that were passed through were saved.

I would have expected that they'd be saved as responses irrespective of whether the question group is hidden from the respondent.

Am I doing something wrong?
The topic has been locked.
  • blocka
  • blocka's Avatar Topic Author
  • Offline
  • Platinum Member
  • Platinum Member
More
6 years 3 months ago #161915 by blocka
Replied by blocka on topic Prefilling answers on repeat submissions
I've attached an LSS of the key parts of the survey. Note that the End Message contains the survey ID in the anchored link -- so if you import and the survey # changes, you'll need to update this in the end message.
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
6 years 3 months ago #161934 by tpartner
Replied by tpartner on topic Prefilling answers on repeat submissions
This is the expected behaviour. If a group or question is rendered irrelevant, the data is not stored.

A workaround would be to change the "deletenonvalues" setting in config.php (but this would affect all surveys and questions) - manual.limesurvey.org/Optional_settings#Survey_behavior

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
  • blocka
  • blocka's Avatar Topic Author
  • Offline
  • Platinum Member
  • Platinum Member
More
6 years 3 months ago #161947 by blocka
Replied by blocka on topic Prefilling answers on repeat submissions
Thanks for this advice. I added it like this to config.php -- but it doesn't work (end URL still doesn't contain the responses). Am I putting it in the config.php correctly:


'debug'=>0,
'debugsql'=>0, // Set this to 1 to enanble sql logging, only active when debug = 2
// Update default LimeSurvey config here
'deletenonvalues'=>0,
)
);
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
6 years 3 months ago #161961 by tpartner
Replied by tpartner on topic Prefilling answers on repeat submissions
Hmm...it does work for me in version 2.72.5 as below. But it looks like you have a trailing comma that's not required.

Code:
  // Use the following config variable to set modified optional settings copied from config-defaults.php
  'config'=>array(
  // debug: Set this to 1 if you are looking for errors. If you still get no errors after enabling this
  // then please check your error-logs - either in your hosting provider admin panel or in some /logs directory
  // on your webspace.
  // LimeSurvey developers: Set this to 2 to additionally display STRICT PHP error messages and get full access to standard templates
    'debug'=>1,
    'debugsql'=>0, // Set this to 1 to enanble sql logging, only active when debug = 2
    'allow_templates_to_overwrite_views'=>1,
    'deletenonvalues'=>0
  )

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
  • blocka
  • blocka's Avatar Topic Author
  • Offline
  • Platinum Member
  • Platinum Member
More
6 years 3 months ago #161965 by blocka
Replied by blocka on topic Prefilling answers on repeat submissions
Well, this is odd. I have the same setting in my config.php.

And with the relevance equation on the Contact question group to hide it if HideOrg=Y, I get this URL in my End Message this first time through:

/index.php/312166?newtest=Y&lang=en&HideOrg=Y&Q13=Organization&Q14=Website&Q15=Local%20Address&Q16=123-123-1234&Q17=Me%20Too


and the 2nd time through, when Contact question group is hidden, I get this as the end URL:

/index.php/312166?newtest=Y&lang=en&HideOrg=Y&Q13=&Q14=&Q15=&Q16=&Q17=

I'm using version 2.72.6 build 171207
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
6 years 3 months ago #161966 by tpartner
Replied by tpartner on topic Prefilling answers on repeat submissions
As I have said, from what I see posted above, you have an extra comma in the config settings.

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
  • blocka
  • blocka's Avatar Topic Author
  • Offline
  • Platinum Member
  • Platinum Member
More
6 years 3 months ago #161967 by blocka
Replied by blocka on topic Prefilling answers on repeat submissions
This is what I now have in my config.php:

// LimeSurvey developers: Set this to 2 to additionally display STRICT PHP error messages and get full access to standard templates

'debug'=>0,
'debugsql'=>0, // Set this to 1 to enanble sql logging, only active when debug = 2
// Update default LimeSurvey config here
'deletenonvalues'=>0
)
);
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
6 years 3 months ago #161968 by tpartner
Replied by tpartner on topic Prefilling answers on repeat submissions
Are the values being recorded in the data? If so, and they still don't appear in the End URL, please report it as a bug.

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
  • blocka
  • blocka's Avatar Topic Author
  • Offline
  • Platinum Member
  • Platinum Member
More
6 years 3 months ago #161970 by blocka
Replied by blocka on topic Prefilling answers on repeat submissions
Nope, they aren't being recorded in the response table either. I'll report it as a bug.
The topic has been locked.
  • blocka
  • blocka's Avatar Topic Author
  • Offline
  • Platinum Member
  • Platinum Member
More
6 years 3 months ago #162129 by blocka
Replied by blocka on topic Prefilling answers on repeat submissions
I'd be interested in paying for a solution to this challenge -- if anyone knows how to fix it, reach out to me!
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose