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

0 votes

[!][1]

I have added 2 PHP-Codes in my survey, with which I should be able to see the previous answers. However, I am receiving an error saying: " For the placeholder %brand1% neither an input field prepare_input() has been created nor any content by using replace()."
From my picture, it is visible that the system recognizes the placeholder, as it has taken the values from my previous answers. Now, how or where do I insert the answers in my next question and with which function?

Thank you!
[1]: https://support.soscisurvey.de/?qa=blob&qa_blobid=10705757524085391841

in SoSci Survey (English) by s199368 (125 points)
Please add your PHP code to the question and post the debug information as text. The screenshot has scaled the text so small that I am not able to read it.

The most common error is to place the PHP code with the replace() below the text with the placeholders. Should that be the case, simply change the order, please.
First PHP-Code:
// prepare placeholder %brand1% and %brand2%
replace('%brand1%', 'FR01_01', 'response');
replace('%brand2%', 'FR01_02', 'response');
// following questions can now use the placeholder %brand%

2nd PHP-Code:
// read participant's answer
$brand1 = value('FR01_01');
$brand2 = value('FR01_02');
// remove blank spaces
$brand1 = trim($brand1);
$brand2 = trim($brand2);
// set up placeholder %brand1%
replace('%brand1%', $brand1);
replace('%brand2%', $brand2);
// following questions can now use the placeholder %brand1%

Error message: " For the placeholder %brand1% neither an input field prepare_input() has been created nor any content by using replace()."

What I want to add before the question: "Previously, you have answered the following: %input:brand1% as the upper bound and %input:brand2% as the lower bound." - This sentence I would like to add either in "Anweisungen" or "Vorspann zu den Items" would this be possible?

Thank you!

1 Answer

+1 vote

What I want to add before the question: "Previously, you have answered the following: %input:brand1% as the upper bound and %input:brand2% as the lower bound."

It seems that you are using %input:brand1% when the placeholder is named %brand1%. Please change that in the question. With the input:, SoSci Survey is looking for a variable in the dataset that is names "brand1".

Thanks for pointing out that the error message is wrong here. It does not really help solving the problem.

by SoSci Survey (223k points)
If I insert %brand1% and %brand2%, then the error message comes:  "For the placeholder %brand1% neither an input field prepare_input() has been created nor any content by using replace()."

Yes, sorry the error message was wrong in the previous. Now it should be correct.
Did you use the placeholder %brand1% in a question? Is the question on the same page like the PHP code? In what order?
I figured out my mistake. My PHP Code was not under the next question, but a few questions afterwards ( under the question were the answers should be shown).

Thank you very much!
> under the question were the answers should be shown

The page would be fine ... but the PHP code has to be above (!) the question that uses the placeholders.
...