0 votes
in SoSci Survey (English) by s212774 (110 points)
closed by SoSci Survey

Hey everyone,
I am trying to assign a value to an internal variable (SD20_01, description: pageID, Text/ string) using java script.
However, I can currently only assign a value by entering one in debug mode, which will then show up in my collected data. I would like to assign a value independent of user input every time the page is opened in the questionnaire. Ultimately, I would like to store a unique id from the web page that is embedded via iframe in the internal sosci variable.
For now my goal is to just assign any value, but my java script does not seem to work. It's based on this page of the user manual: https://www.soscisurvey.de/help/doku.php/en:create:questions:internal and looks like this:

<script type="text/javascript">
<!--

var input = document.getElementById("SD20_01");
input.value = "wow this works";

}
// -->
</script>

I will attach an image of the current status.
I would really appreaciate any ideas, I feel like I might be missing something obvious.
Kind regards,
Anna

closed with the note: There has been no response to the question in the comment, so we assume that the issue is already solved.
by SoSci Survey (327k points)
From the screenshot it looks like there is no `<script>`  in your text element "test_var" ... could that be the case?

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

...