Pre-population of questions.....

More
5 years 8 months ago #71365 by Steve01
Steve01 replied the topic: Aw: Re: Pre-population of questions.....

rocksalt wrote: i tried using the SCGA path...

limesurvey.local/index.php?sid=51679&51679X8X48XQ1=Y

simple yes no radio button choice.....

does not work...

tried with survey active, and is not anonymous...i think there's something else here, but seeing as this is my first attempts with a scga i probably have done something wrong somewhere


If I remember correctly you can't use something like "51679X8X48XQ1" with SGQA for this type of question. You have to use the question "51679X8X48" and set the value with "=Y" so it should be "51679X8X48=Y".

Mit freundlichen Grüßen/Best regards,

Stefan Gohlke
LimeSurvey Team

Please Log in to join the conversation.

More
5 years 8 months ago #71366 by rocksalt
rocksalt replied the topic: Aw: Re: Pre-population of questions.....
tried that... well... again after you mentioned it...

I've been testing the logic of it thus:

limesurvey.local/index.php?sid=51679&51679X8X48XQ1=Y
limesurvey.local/index.php?sid=51679&51679X8X48=Y
limesurvey.local/index.php?sid=51679X8X48XQ1=Y
limesurvey.local/index.php?sid=51679&X8X48XQ1=Y
limesurvey.local/index.php?sid=51679&X8X48=Y

none of these seem to work...

just a thought... this survey has just one question.... would i need another ?

i just added another question to it, as a seperate question group... still nothing.
i've changed it from a yes/no to a short text field.... stopped, started the survey again... re-ran the question url... was expecting "y" to appear in the box.... changed it to "tom" expecting tom to appear in box... nothing.

Please Log in to join the conversation.

More
5 years 8 months ago #71367 by rocksalt
rocksalt replied the topic: Aw: Re: Pre-population of questions.....
i've been basing my testing on this:

Prefilling survey answers using the survey URL

Tested with: 1.80RC3

You can prefill answers to questions in your survey by passing the SGQA Identifier, and the answer, as a parameter of your survey URL. This feature will only work where the survey is commenced immediately upon entering the URL (so it won't work if you use CAPTCHA's to restrict access, or the registration page).

You'll need to ensure that the answer you pass is the correct format for the question you are attempting to prefill - for example - multiple option questions should contain a "Y" to check a box. List type questions need the correct answer code. To be certain which codes to pass, complete a survey manually with the prefilled answer(s) you want, and then export the results as question codes and answer codes(not full text). This will give you both the correct SGQA identifier (the name of the column), and the correct format for the answer.

Example:
http://www.myownd.../index.php?sid=1234&1234X43X123=Y

When the user gets to that question, the "Y" will be prefilled as the answer to question 123 in group 43 in survey 1234.


is this still current ?

Please Log in to join the conversation.

More
5 years 8 months ago #71368 by rocksalt
rocksalt replied the topic: Aw: Re: Pre-population of questions.....
interestingly...

when i set question one as mandatory and then enter the following

index.php?sid=51679&51679X8X48=Tom&51679X8X49=123456

it gives an error that i can't continue as Q1 is mandatory... but doesn't add anything to the question field so the &51679X8X48=Tom portion.... is not being parsed into the field.

Please Log in to join the conversation.

More
5 years 8 months ago - 5 years 8 months ago #71369 by rocksalt
rocksalt replied the topic: Aw: Re: Pre-population of questions.....
and also this.. which is more current....

Identifier for Array <a href=' www.docs.limesurvey.org/tiki-index.php?p...tions+for+LimeSurvey '>question types</a>

Since it is a array question the particular subquestion within the cell must be identified too. Add the subquestion code of the row without an X. For example: Survey has ID 1, Group has ID 6, Question has ID 12. The particular subquestion has code 'ber1'. Your identifier for this "Array" question answer would look like this:

1X6X12ber1


Identifier for Array (Text) or Array (Number) Questions

Since it is a combined array question the particular answer within the cell must be identified too. Add the subquestion code of the row without an X, then append the underscore char and finally add the subquestion code that indentifies the column. For example: Survey has ID 1, Group has ID 6, Question has ID 12. The particular subquestion has code 'ber1', and the column is identified by the subquestion with code 'lab1'
Your identifier for this "Array (Text)" question answer would look like this:

1X6X12ber1_lab1

Uses of the <a href=' www.docs.limesurvey.org/tiki-index.php?p...tions+for+LimeSurvey '>SGQA</a> identifier

The <a href=' www.docs.limesurvey.org/tiki-index.php?p...tions+for+LimeSurvey '>SGQA</a> identifier can be used to load the answers to previously saved questions into the question text of later questions. (See Adding a Question - Information from previous answers)

It can also be used in the query URL of a survey to "prefill" answers to a survey. eg: for <a href=' www.docs.limesurvey.org/tiki-index.php?p...tions+for+LimeSurvey '>SGQA</a> 1X6X121ab1, your query URL could include "&1X6X121ab1=Y" to prefill that answer with a "Y". (See workarounds -> Prefilling survey answers using the survey URL)

The <a href=' www.docs.limesurvey.org/tiki-index.php?p...tions+for+LimeSurvey '>SGQA</a> identifier is also the field name where the data for each question is stored in the database survey responses table.

Dynamically reference the SGQ identifier

Some people may find a need to reference a question dynamically. For instance, if you would like to hide the input text field of a short text answer. You can now do this (as of SVN build 9755) by using the {SGQ} identifier. LimeSurvey will replace the {SGQ} with the full Id of that question, ex: 3583X84X249
Contributors to this page: timbee , anonymous and admin .
Page last modified on Thursday 10 of February, 2011 19:44:51 CET by timbee.
Last Edit: 5 years 8 months ago by rocksalt.

Please Log in to join the conversation.

More
5 years 8 months ago - 5 years 8 months ago #71371 by rocksalt
rocksalt replied the topic: Aw: Re: Pre-population of questions.....
Ok... new tack...

i've deleted survey.
Created new one with single question group and two questions ( name and tel number )

played the url : index.php?sid=88997&lang=en&88997X10X50=Tommy&88997X10X51=1234

and its now populating both fields correctly.

so something in the old survey was not allowing the data to parse through?

i've stopped, started, manually edited, added data etc... generally most things i was doing to the previous survey.... and it still works... most wierd. Now im working on how to interpret the data url link from remedy into a format LS can parse
Last Edit: 5 years 8 months ago by rocksalt.

Please Log in to join the conversation.

More
5 years 8 months ago #71372 by Steve01
Steve01 replied the topic: Aw: Pre-population of questions.....
Hello,

I tested the SGQA for the yes/no question with a survey in my LimeSurvey installation 1.91+ Build 11379. It seems
limesurvey.local/index.php?sid=51679&51679X8X48=Y
should be correct. If it doesn't work you may have a look at the source code of your HTML page and check if the SGQA code (look for an element like <input id="answer51679X8X48Y" ... >) and the value (something like value="Y") are correct.

Mit freundlichen Grüßen/Best regards,

Stefan Gohlke
LimeSurvey Team
The following user(s) said Thank You: rocksalt

Please Log in to join the conversation.

More
5 years 8 months ago - 5 years 8 months ago #71373 by rocksalt
rocksalt replied the topic: Aw: Pre-population of questions.....
thanks vierundzwanzig.

Now i have the url thing working, i'm going to try the java script and embed that in the survey and interpret the url to parse data to the fields.... i feel this gives me the best way forward on this... although java and me were distant friends at best lol
Last Edit: 5 years 8 months ago by rocksalt.

Please Log in to join the conversation.

More
5 years 8 months ago #71385 by TMSWhite
TMSWhite replied the topic: Aw: Pre-population of questions.....
rocksalt-

I just tested with 1.92 RC1. It does accept the URL parameters appropriately, with one nuance. Although you can pass in any parameters you want (which could be on any page / in any group), LS will always validate the data before displaying it. So, if you set a value of a variable that is irrelevant, LS will NULL that value before the page is displayed. This ensures that the database is internally consistent.

/Tom

Please Log in to join the conversation.

More
5 years 8 months ago #71391 by rocksalt
rocksalt replied the topic: Aw: Pre-population of questions.....
ahhh... for for the data im trying to parse into the question field, i need to pre validate this?
I left the validation field empty on my questions as the data being entered could be anything ( names, telephone numbers call ref etc. )
but i assume there's some kind of validation check to ensure the name Y. smitth couldn't to taken as a Y answer for yes/no ?

Please Log in to join the conversation.

More
5 years 8 months ago #71395 by TMSWhite
TMSWhite replied the topic: Aw: Pre-population of questions.....
rocksalt-

I meant to say that 1.92 will validate whatever data you try to enter. 1.91+ may also do this, but I'm not sure about that detail.

So, using the attached sample survey as an example, if I give the following URLs, I get the described results:
http://localhost/limesurvey_dev/index.php?sid=27246&newtest=Y&lang=en&27246X5X33=Y&27246X5X35=25&27246&27246X7X37=Tom

Yields this:



and when you click next twice, you get this:



However, if I use this URL (which does not make QID 35 irrelevant):
http://localhost/limesurvey_dev/index.php?sid=27246&newtest=Y&lang=en&27246X5X33=Y&27246X5X35=25&27246&27246X7X37=Tom

You get this:



and then if you select C for Question Q2, you get this, which shows that the passed-in value of 25 for Q3 has been NULLed:



Here is the survey I'm referencing. Pages 1-2 are courtesy of lemeur:

File Attachment:

File Name: limesurvey...7246.lss
File Size:58 KB


/Tom

Please Log in to join the conversation.

More
5 years 8 months ago #71396 by rocksalt
rocksalt replied the topic: Aw: Pre-population of questions.....
Thanks Tom, that clears that up nicely :)

Please Log in to join the conversation.

More
5 years 8 months ago #71613 by Mazi
Mazi replied the topic: Aw: Pre-population of questions.....
If you are looking for a more generic solution I can think of making an Ajax call on every survey page, passinbg a certain user ID to a PHP script. That script then gets the according data from an external DB and passes back an array which is read by some JS to populate the according survey fields (there are variations of that approach).


Best regards/Beste Grüße,
Dr. Marcel Minke
(Limesurvey Head of Support)
Need Help? We offer professional Limesurvey support
Contact: marcel.minke(at)survey-consulting.com'"

Please Log in to join the conversation.

More
5 years 8 months ago #71641 by rocksalt
rocksalt replied the topic: Aw: Pre-population of questions.....
i actually solved it with a native parsing of the url.
i found the field names corresponded to the email url i was trying to push... so in the end i didn't have to do anything fancy except change the url to match what we being outputted by our template email to match that which LS was expecting.

Please Log in to join the conversation.

More
5 years 8 months ago #71714 by Mazi
Mazi replied the topic: Aw: Pre-population of questions.....
rocksalt, can you post your solution at manual -> workarounds so others will benefit frim it, too?!

Thanks!


Best regards/Beste Grüße,
Dr. Marcel Minke
(Limesurvey Head of Support)
Need Help? We offer professional Limesurvey support
Contact: marcel.minke(at)survey-consulting.com'"

Please Log in to join the conversation.

Start now!

Just create your account and start using Limesurvey today.

Register now