Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Field - Hidden default values lost on pause/resume. #14

Open
jonpikum opened this issue Oct 2, 2015 · 1 comment
Open

Field - Hidden default values lost on pause/resume. #14

jonpikum opened this issue Oct 2, 2015 · 1 comment

Comments

@jonpikum
Copy link

jonpikum commented Oct 2, 2015

When using a Field - Hidden text box to collect information from the URL with ##DefaultValue## set on the answer, the value passed through the URL is lost after pausing and resuming.

Steps to reproduce:

  1. Create new survey with manual resume mode
  2. Create answer type Field - Basic as our control case
  3. Set the "Default text value" box to equal "##DefaultURLValue##"
  4. Create answer type Field - Hidden as our test case
  5. Set the "Default text value" box to equal "##DefaultURLValue##"
  6. Open the survey with "&DefaultURLValue=ThisIsADefaultValue" appended to the URL
  7. Save Progress & keep track of resume code
  8. Check database to see that the value saved once for each answer
  9. Open the survey again, this time omitting the URL parameter
  10. Select resume and enter the resume code
  11. Take note that the Field - Basic text box retains the original URL parameter value
  12. Submit the survey
  13. View the voter report or look in the database to see that the original URL parameter value has been replaced with an empty string for the Field - Hidden answer.

My thoughts:
I'm pretty sure the "why" of this is that on the answers being submitted from the client, because the URL parameter is missing, the empty string overwrites the original value from before the values are submitted to the database, since the original value would not be included in the OnAnswersSubmit() function, unlike the Field - Basic answer which set the AnswerText on the client.

In our implementation of the application, we collect a small amount of information before directing the user to the survey, and then store that information passed through the URL as part of the survey.
We don't know what the query string parameters were supposed to be when resuming and therefore cannot repopulate the URL identically from the client-side. Currently, the only thing we know is the resume code.

I'm fairly certain this was not intended behavior, but I have yet been unable to pinpoint the origin of the issue. It seems that sometime between loading the VoterAnswers on resume (line 1344 of SurveyBox.cs) and the merge between VoterAnswers and currentVisitorAnswerSet on SubmitAnswersToDb() (line 1518 of SurveyBox.cs), the original value is lost and overwritten.

My current workaround ideas that I have yet to attempt to implement include
A. Create a new AnswerType to replace Field - Hidden that renders the text box on the client, and is set to display: none in the CSS so that the AnswerText is set and also passed when submitting the answers
B. Attempt to recreate the original URL parameters by querying the database on resume and redirecting the user to the appropriate URL with the parameters set.

Any thoughts or suggestions for a fix? We are losing data / receiving bad data every time a user pauses and resumes a survey.

@fwsmaster
Copy link
Contributor

Hello,

Thank you for reporting. I can confirm the issue as described and have been able to replicate it. It is certainly no the intended working. It will we registered as an issue to be fixed.

Kind regards
SP Coordinator

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants