Hi all,
is it possible to access the last value (if answered) of the the current question from within perl script?
I need to output different HTML-Code in a free-form question based on the save variable state of the question. Example:
If the user filled the variable "q2_year" (input type text) on Q2 and moves on to Q3 and then navigates back to Q2 I want to modify the free-form content in Q2 based on the "q2_year" variable the user specified on an earlier Q2 visit.
GETVALUE in unverified Perl Script doesn't seem to work:
[% Begin Unverified Perl
my $str = "";
my $year = GETVALUE("q2_year");
#
# I know that this code runs on the server but I want to display the q2_year input-field only if the user already
# filled out the form (e.g. navigating back to this question from q3)
#
# I know that the "code" is extra verbose and not optimized :P
#
if (GETVALUE("q2_radio") eq "1" && $year ne "") {
$str = qq(<input name="q2_year" id="q2_year" type="text" size="20" value="$year">);
} else {
$str = qq(<input name="q2_year" id="q2_year" type="text" size="20" value="" style="display: none;">);
}
return $str;
End Unverified %]
$ra is always empty :-(.
Any ideas on what's wrong?
Thanks in advance!