Assistance welcome: Zip Code Indexing

hi!

I have a question about a problem with sawtooth Lighthouse that I have already posted here.

So in our study we have a numeric field where respondents enter their postcode and we want to assign an index value based on that postcode. So we thought about using the GEtVALUE-SETVALUE mechanism, but as we had problems with that, we decided to use a simple code where we define categories for the postcode input and display the categories as error messages. As error messages are not exactly what we want, but rather a text output including the category on the next page of the survey, we wondered how we could do this and if you could help us. So we would like to ask you how to display this error message not as an error but as a text output and would be very grateful for any help!

Another solution to deal with the treatment would be to use a Unverified Perl, I tried to use it with the following code, but it doesn´t seem to work as the first category is always displayed. Can you spot any error with that?

[% Begin Unverified Perl

my $typeId = GETVALUE('tryInput2');

if ($typeId == 10115 || 10116) {

return 'Sie sind stark betroffen';

}

if ($typeId == 2) {

return 'Sie sind nicht betroffen';

}

End Unverified %]

And here is the code for the alert texts:

var zipCode = '[% WritePLZ %]'

if (zipCode == 10115 || 10116)

{alert('Stark betroffen');          

}

else if (zipCode == 10117)

{   alert('Mäßig betroffen')

}

else

{                alert('False PLZ')

}

var category = 42

{       strErrorMessage = 'Error.' + category; }

 

Thank you very much,

Natalie

3 replies