0 votes
in SoSci Survey (dt.) by s240695 (130 points)

Hallo zusammen,

ich würde gerne offene Nennungen in einer weiteren Frage aufgreifen und mittels Likert-Skala bewerten lassen.

Dazu habe ich in der Folgefrage die max. 10 möglichen Antwortoptionen mit

%text1% %text2% %text3% %text4% %text5% %text6% %text7% %text8% %text9% %text10%
hinterlegt.

Bei der Folgefrage habe ich folgenden Code hinterlegt:

$frage = 'TX01';
$items = array();
for ($i=1; $i<=10; $i++) {
  $itemID = id($frage, $i);
  $antwort = value($itemID);
  if (trim($antwort) != '') {
    replace('%text'.$i.'%', $antwort);
    $items[] = $i;
  }
}
// Folgefrage anzeigen
if (count($items) > 0) {
  question('FF01', $items);
}

Wenn ich jedoch weniger als 10 offene Nennungen habe, werden die Platzhalter trotzdem in der Folgefrage angezeigt und es erscheint folgende Fehlermeldung:

For the placeholder %text4% neither an input field by prepare_input() has been created nor any content by using replace().

Wie werden nur die offenen Nennungen angezeigt, die auch tatsächlich eingegeben worden sind?

by SoSci Survey (304k points)
Bitte ergänzen Sie am Ende Ihres COdes einmal die folgende Zeile:

debug($items);

Und posten Sie bitte die komplette Debug-Information der Seite mit dem PHP-Code: https://www.soscisurvey.de/help/doku.php/de:create:debugging

1 Answer

0 votes
by s240695 (130 points)

Den Phd-Code habe ich wie folgt ergänzt:

$frage = 'CS05';
$items = array();
for ($i=1; $i<=10; $i++) {
$itemID = id($frage, $i);
$antwort = value($itemID);
if (trim($antwort) != '') {

replace('%text'.$i.'%', $antwort);
$items[] = $i;

}
}
// Folgefrage anzeigen
if (count($items) > 0) {
question('FF01', $items);
}
debug($items);

Im Debug-Modus erhalte ich folgende Fehlermeldung:

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

...