0 votes
in SoSci Survey (English) by s104186 (150 points)
edited by s104186

Hello,

I would like to display a selection type question inside a table. Im not sure what the coding should be to display the question inside the table. I have a random generator created with the question ID's.

Any help would be appreciated.

Thanks

1 Answer

0 votes
by SoSci Survey (328k points)

You are probably looking for the method to place inputs whereever you like.

Unfortunately, the English manual is a bit outdated. You do not need prepare_input() any more, only use a placeholder like %input:AB01_01% where AB01 is the ID of your selection question. If this is a dropdown, use %input:AB01%.

by s104186 (150 points)
I would like to use it in an elseif statement, like below:

$code= value('PR01');        //PR01 is a random generator
if ($code==1){
'%input:PS01%';}
elseif ($code==2){
'%input:PS02%';}
elseif ($code==3){
'%input:PS03%';}
elseif ($code==4){
'%input:PS04%';}

but I am unsure how to code it so that i can display the randomly chosen question in the table.
by SoSci Survey (328k points)
Okay, that's a bit mor difficult ... If you're showing only the input from a question (this is what the placeholder is for - and it has to be used in the question's content, not in the PHP code), when why do you want to display different inputs? What is the difference between PS1, 2, 3 and 4?
by s104186 (150 points)
they are different price options that is to be presented at random. there are PS01 uptil PS07 different price options.
by SoSci Survey (328k points)
I assume, the question is a dropdown?

Please give this here a try:

$code= value('PR01');        //PR01 is a random generator
if ($code==1){
  replace('%question%', '%input:PS01%');
} elseif ($code==2) {
  replace('%question%', '%input:PS02%');
}  // ...

Then use %question% as placeholder in your HTML table. I am not perfectly sure if the replacement will work recursively, but it should do two steps. If that does not work, please let me known.
by s104186 (150 points)
The question is a horizontal type selection.

However, I used the codes given above and it worked just fine and the data is being saved normally.

Thank you.

Willkommen im Online-Support von SoSci Survey.

Hier bekommen Sie schnelle und fundierte Antworten von anderen Projektleitern und direkt von SoSci Survey.

→ Eine Frage stellen


Welcome to the SoSci Survey online support.

Simply ask a question to quickly get answers from other professionals, and directly from SoSci Survey.

→ Ask a Question

...