Pre-populating answers with custom token attributes

Mehr
5 Jahre 9 Monate her #73431 von tacman1123
tacman1123 erstellte das Thema Pre-populating answers with custom token attributes
I want to confirm the user's name, email address and zip code, data I have. I can add those fields to the tokens table, and then say

Our records show that your email address is {TOKEN:EMAIL}. If this is not correct, add the new email below.

But then it will only work if the survey is taken via a token.

What I really want is to pre-populate the answers based on the token (if the survey is taken that way). Otherwise it'd just be the default, e.g.

Please enter your email:

and then have the answer there.

I was hoping to see a Default Answer in the Advanced Options, with the ability to add {TOKEN:EMAIL} as the default.

Is there another way to do this easily?

Thx,

Tac

Bitte Anmelden um an der Konversation teilzunehmen.

Mehr
5 Jahre 9 Monate her - 5 Jahre 9 Monate her #73433 von fransmarcelissen
fransmarcelissen antwortete auf das Thema: Pre-populating answers with custom token attributes
Hi,
Good news, what you want is exactly what I do in my questionnaires in 1.92rc3. 1.92 has the option of defining defaults for text fields. But the defaults are not in the advanced options, but as a button along the conditions button. As a default you can set {TOKEN:EMAIL}, so the user can keep this or change it if he wants. The default can also be a EM script. Of course the TOKEN does not change.
Frans
Letzte Änderung: 5 Jahre 9 Monate her von fransmarcelissen.
Folgende Benutzer bedankten sich: tacman1123

Bitte Anmelden um an der Konversation teilzunehmen.

Mehr
5 Jahre 9 Monate her #73457 von Mazi
Mazi antwortete auf das Thema: Pre-populating answers with custom token attributes
Frans, is this already documented at our manual? If not, can you please add a note there on how to use token data for default settings!?

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'"

Bitte Anmelden um an der Konversation teilzunehmen.

Mehr
5 Jahre 9 Monate her #74186 von tacman1123
tacman1123 antwortete auf das Thema: Pre-populating answers with custom token attributes
I love the ability to have defaults based on tokens. Sometimes, especially when demoing and developing the site, I want to offer the ability to take the survey without tokens. Right now, it's throwing an error if the token isn't defined.

Is there a way to check for the existence of a token before using it? For example, if I have a field called "industry" in my token list (ATTRIBUTE_1), but the token table hasn't been initialized yet, I just want it to be blank. So maybe something like

Default: IF isset({TOKEN:ATTRIBUTE_1}) TOKEN:ATTRIBUTE_1 ELSE "";

Is that something that's even possible?

Or is there another approach that would work better? In particular, I want to be able to give a link to someone and say "Please review this survey" and not have it fail if I have default answers that will be populated if it's coming from a token-based survey.

Thx,

Tac

Bitte Anmelden um an der Konversation teilzunehmen.

Mehr
5 Jahre 9 Monate her #74223 von Mazi
Mazi antwortete auf das Thema: Pre-populating answers with custom token attributes
This might be possible when using the Expression Manager at Limesurvey 1.92 but for the current 1.91 version I don't know any such solution.


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'"

Bitte Anmelden um an der Konversation teilzunehmen.

Mehr
5 Jahre 9 Monate her #74356 von DenisChenu
DenisChenu antwortete auf das Thema: Pre-populating answers with custom token attributes
Hello,

I think you can use:
A token table for invitation, set to no-anonymous.

A token with : newinscription for tokencode, set to 1000000 answer ( or more ;).

And in the survey you can use condition to show:
Your email: please put your mail adress: < input >
OR:
Can you confirm your mail adresse YES/NO
( if no : give an new question with your email )

You can fill to an input with the email for token table.
( $("#question"+QQ+" input.text").val('{TOKEN:EMAIL}');

Denis :)

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand (or search sondages pro).
An error happen ? Before make a new topic : remind the Debug mode .

Bitte Anmelden um an der Konversation teilzunehmen.

Mehr
5 Jahre 2 Monate her #84880 von ricardo01
ricardo01 antwortete auf das Thema: Pre-populating answers with custom token attributes
Denis, I was wondering if you could explain how to achieve what you're saying here:

A token table for invitation, set to no-anonymous. DONE

A token with : newinscription for tokencode, set to 1000000 answer ( or more) How? What is a"newinscription" How can I set it to 1000000? where?

You can fill to an input with the email for token table.
( $("#question"+QQ+" input.text").val('{TOKEN:EMAIL}'); Where do I write this?

Thanks!

Bitte Anmelden um an der Konversation teilzunehmen.

Mehr
5 Jahre 2 Monate her #84881 von Mazi
Mazi antwortete auf das Thema: Pre-populating answers with custom token attributes

ricardo schrieb: A token with : newinscription for tokencode, set to 1000000 answer ( or more) How? What is a"newinscription" How can I set it to 1000000? where?

I think Denis was talking about the "uses_left" column at which you can define the number of times a certain token can be used.

ricardo schrieb: You can fill to an input with the email for token table.
( $("#question"+QQ+" input.text").val('{TOKEN:EMAIL}'); Where do I write this?

Try adding this code at the source code mode of the editor at the related question:
<script>
   $(document).ready(function() 
   {
      $("#question"+QQ+" input.text").val('{TOKEN:EMAIL}');
   });
</script>
^- replace "QQ" with your question ID.


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'"

Bitte Anmelden um an der Konversation teilzunehmen.

Mehr
5 Jahre 2 Monate her #84883 von ricardo01
ricardo01 antwortete auf das Thema: Pre-populating answers with custom token attributes
Thanks, Mazi

My question ID is 4903...and this is the script I'm using...is this correct?

<script>
$(document).ready(function()
{
$("#question"+4903+"input.text").val('{TOKEN:EMAIL}');
});
</script>

it's not prepopulating anything yet

Bitte Anmelden um an der Konversation teilzunehmen.

Mehr
5 Jahre 2 Monate her #84886 von Ben_V
Ben_V antwortete auf das Thema: Pre-populating answers with custom token attributes
At first glance (in your last script) a white-space is missing just before "input.text"

Wrong:
$("#question"+4903+"input.text").val('{TOKEN:EMAIL}');


Correct:
$("#question"+4903+" input.text").val('{TOKEN:EMAIL}');


Ben/

Benoît

EM Variables => bit.ly/1TKQyNu | EM Roadmap => bit.ly/1UTrOB4
Last Releases => 2.6x.x goo.gl/ztWfIV | 2.06/2.6.x => bit.ly/1Qv44A1
Demo Surveys => goo.gl/HuR6Xe (already included in /docs/demosurveys)

Bitte Anmelden um an der Konversation teilzunehmen.

Mehr
3 Jahre 1 Monat her #113229 von jpperrein
jpperrein antwortete auf das Thema: Pre-populating answers with custom token attributes

fransmarcelissen schrieb: Hi,
Good news, what you want is exactly what I do in my questionnaires in 1.92rc3. 1.92 has the option of defining defaults for text fields. But the defaults are not in the advanced options, but as a button along the conditions button. As a default you can set {TOKEN:EMAIL}, so the user can keep this or change it if he wants. The default can also be a EM script. Of course the TOKEN does not change.
Frans


Hi, I canno't make this working. The condition part ask me to create a condition. Must be a trick to use it so a default value based on invitation table can be used.

Any clues, would it be possible to have an example ?

Many thanks

Bitte Anmelden um an der Konversation teilzunehmen.

Mehr
3 Jahre 1 Monat her - 3 Jahre 1 Monat her #113274 von tpartner
tpartner antwortete auf das Thema: Pre-populating answers with custom token attributes
This has nothing to do with conditions. Frans simply meant that the "Default answers" button is beside the "Set Conditionss" button.




.

Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Anhang:
Letzte Änderung: 3 Jahre 1 Monat her von tpartner.

Bitte Anmelden um an der Konversation teilzunehmen.

Mehr
3 Jahre 1 Monat her #113296 von jpperrein
jpperrein antwortete auf das Thema: Pre-populating answers with custom token attributes
Hi,

Ok, many thanks, indeed, I can choose a default value for text purpose. That works fine.
But what if I want to set the default value to an {TOKEN:ATTRIBUTE_1} to a List (radio) question ? - I do not have any place to add my variable, like the text one.

Any clues ?

Many thanks

Bitte Anmelden um an der Konversation teilzunehmen.

Mehr
3 Jahre 1 Monat her #113299 von tpartner
tpartner antwortete auf das Thema: Pre-populating answers with custom token attributes
To set defaults for radio questions you can use the Expression Manager Assignment operator in a following equation type question - manual.limesurvey.org/Expression_Manager..._Assignment_Operator

Be sure to make it conditional on the radio being unanswered. Something like:
{qRADIO = if(qRADIO == "", TOKEN:ATTRIBUTE_1, qRADIO)}


.

Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.

Bitte Anmelden um an der Konversation teilzunehmen.

Mehr
3 Jahre 1 Monat her #113303 von jpperrein
jpperrein antwortete auf das Thema: Pre-populating answers with custom token attributes
Re,

Ok, the condition is a good thing, thanks.
But I did test it and it does fill the question text but do not change anything on the answer :

What I have done : (ATTRIBUTE_1 = CAT1)

CODE : categorie
QUESTION: Hello, this is my question ... ?
{Categorie = if(Categorie == "", TOKEN:ATTRIBUTE_1, Categorie)}
HELP :nohelp

And the result is
TEXT of QUESTION : Hello, this is my question ... ?
CAT1

O Catégorie 1 (do have the code CAT1)
O Catégorie 2 (do have the code CAT2)
O Catégorie 3 (do have the code CAT3)

So it does "write" CAT1, but on the text of the question, not changing the value of the choice itself.

Hard to explain, sorry :side: .Do you see the issue ?

Many thanks for your help.

Bitte Anmelden um an der Konversation teilzunehmen.

Jetzt loslegen!

Melden Sie sich jetzt an, und erstellen Sie in wenigen Minuten Ihre erste Umfrage.

Account einrichten

Abonnieren Sie unseren Newsletter

Abonnieren Sie unseren Newsletter für alle Neuigkeiten rund um LimeSurvey
captcha