SETVALUE, based on condition and using Perl

I want to change the value of a question based on a previous question.

The code is something like this:

[% Begin Unverified Perl

if(GETVALUE("F1") == 1)

{ SETVALUE("F2",1);}

if(GETVALUE("F1") == 2)

{ SETVALUE("F2",1);}

elsif(GETVALUE("F1") == 3)

{ SETVALUE("F2",2);}

End Unverified %]

F2 comes right after F1

Should I put this code on the footer of F1 or F2?

I did both and it does not work while testing the survey. What I am doing wrong?

5 replies