Checkbox default answer from tokens

Mehr
6 Monate 2 Wochen her #169084 von waitz
waitz erstellte das Thema Checkbox default answer from tokens
I want to pre-tick a checkbox based on the value in a token, so that if the token attribute_51 has value=1, then pre-tick checkbox, and if attribute_51 has value value=2, leave the checkbox unticked.

In the default answers of a checkbox, there are only the options: <no default value> or Checked.

How can I pre-check them based on token value?

Thanks

Version 2.73.1+171220

Bitte Anmelden oder Registrieren um an der Konversation teilzunehmen.

Mehr
6 Monate 2 Wochen her #169094 von tpartner
tpartner antwortete auf das Thema: Checkbox default answer from tokens
Try adding a hidden (via CSS) equation question after the check-box question.

Q1_SQ001 = if(TOKEN:ATTRIBUTE_1 == '1', 'Y', '')

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

Bitte Anmelden oder Registrieren um an der Konversation teilzunehmen.

Mehr
6 Monate 2 Wochen her #169100 von simonchrist
simonchrist antwortete auf das Thema: Checkbox default answer from tokens
In Version 2.73 we did this by passing the value with the invitation URL.
For example, there is a dropdown list called [RZ] with answer options in multiple languages.

The E-Mail Template there is the survey url: @@SURVEYURL@@&RZ={TOKEN:ATTRIBUTE_1}

-> this sets the default value for RZ to ATTRIBUTE_1, which is only the answer code.

In our case, RZ as dropbox was hidden, but we displayed {RZ.shown} as Text, which is the answer text of RZ in the selected language.

Unfortunately, this does not work in version 3.8.0 anymore! Does anyone know a solution for that?

Thanks

Bitte Anmelden oder Registrieren um an der Konversation teilzunehmen.

Mehr
6 Monate 2 Wochen her #169164 von waitz
waitz antwortete auf das Thema: Checkbox default answer from tokens
Thank you Tony, that looks like a direction. With the new LS version, where can I find documentation of how to find the right Q_SQ id? The question has id 180 and the subquestion code NEW01. Does that give the code Q180_SQNEW01?
I tried, but id didn't work...
And secondly, I would want to add the code for two subquestions under the same question: NEW01 and NEW02. Do I then add the code above twice with a separation between them, or is there a more elegant way?

Thanks

Version 2.73.1+171220

Bitte Anmelden oder Registrieren um an der Konversation teilzunehmen.

Mehr
6 Monate 2 Wochen her #169170 von tpartner
tpartner antwortete auf das Thema: Checkbox default answer from tokens
What is the question code?

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

Bitte Anmelden oder Registrieren um an der Konversation teilzunehmen.

Mehr
6 Monate 1 Woche her - 6 Monate 1 Woche her #169328 von waitz
waitz antwortete auf das Thema: Checkbox default answer from tokens
Hi, the question id is 180, and the subquestion code is New01 and New02. I don't see a code for the main question, if there is one.


Version 2.73.1+171220
Letzte Änderung: 6 Monate 1 Woche her von waitz.

Bitte Anmelden oder Registrieren um an der Konversation teilzunehmen.

Mehr
6 Monate 1 Woche her #169342 von tpartner
tpartner antwortete auf das Thema: Checkbox default answer from tokens

Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Anhang:
Folgende Benutzer bedankten sich: LouisGac

Bitte Anmelden oder Registrieren um an der Konversation teilzunehmen.

Mehr
6 Monate 1 Woche her - 6 Monate 1 Woche her #169354 von waitz
waitz antwortete auf das Thema: Checkbox default answer from tokens
Ahh, I understand (I think).


I added a new equation question after the question and in Logic > Equation, I added: QNEWSLETTER_SQNEW01 = if(TOKEN:ATTRIBUTE_50 == '1', 'Y', '')



But it didn't work... The checkbox should have been ticked, and it wasn't...

Version 2.73.1+171220
Letzte Änderung: 6 Monate 1 Woche her von waitz.

Bitte Anmelden oder Registrieren um an der Konversation teilzunehmen.

Mehr
6 Monate 1 Woche her #169355 von tpartner
tpartner antwortete auf das Thema: Checkbox default answer from tokens
You don't need the "Q" and "SQ" parts and it should be wrapped in curly braces.

{NEWSLETTER_NEW01 = if(TOKEN:ATTRIBUTE_50 == '1', 'Y', '')}


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

Bitte Anmelden oder Registrieren um an der Konversation teilzunehmen.

Mehr
6 Monate 1 Woche her #169357 von waitz
waitz antwortete auf das Thema: Checkbox default answer from tokens
Great, super. It looks like it worked. And if I want to have a similar equation for several sub-questions, I just add one equation after the other, right?

Thank you!!

Version 2.73.1+171220

Bitte Anmelden oder Registrieren um an der Konversation teilzunehmen.

Mehr
6 Monate 1 Woche her #169358 von tpartner
tpartner antwortete auf das Thema: Checkbox default answer from tokens
Yes, you will need to place them in separate equation type questions.

Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Folgende Benutzer bedankten sich: waitz

Bitte Anmelden oder Registrieren um an der Konversation teilzunehmen.

Mehr
6 Monate 1 Woche her - 6 Monate 1 Woche her #169360 von waitz
waitz antwortete auf das Thema: Checkbox default answer from tokens
OK, thank you for your help.


PS: Actually I just placed them in the same equation like this: {NEWSLETTER_NEW01 = if(TOKEN:ATTRIBUTE_50 == '1', 'Y', '')}{NEWSLETTER_NEW02 = if(TOKEN:ATTRIBUTE_51 == '1', 'Y', '')}
And it worked

Version 2.73.1+171220
Letzte Änderung: 6 Monate 1 Woche her von waitz.

Bitte Anmelden oder Registrieren um an der Konversation teilzunehmen.

Mehr
6 Monate 1 Woche her #169514 von waitz
waitz antwortete auf das Thema: Checkbox default answer from tokens
PS: Can I move the equation into the question field of a normal text field question? And if so, do I need to wrap {NEWSLETTER_NEW01 = if(TOKEN:ATTRIBUTE_50 == '1', 'Y', '')}{NEWSLETTER_NEW02 = if(TOKEN:ATTRIBUTE_51 == '1', 'Y', '')} inside a script tag?

Version 2.73.1+171220

Bitte Anmelden oder Registrieren um an der Konversation teilzunehmen.

Mehr
6 Monate 6 Tage her #169532 von tpartner
tpartner antwortete auf das Thema: Checkbox default answer from tokens
No, it must be in an equation question.

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

Bitte Anmelden oder Registrieren 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