I have accomplished this within a free format question.
For the single response option, I created "RadioFreeFormatQ" and gave it a hidden variable named "Radio." This is the code I put in the HTML section:
<div id="ffImgContainer">
[% Begin Unverified Perl
my $htmlOut = '';
my $imgDiv = '';
for (my $i = 1; $i <= LISTLENGTH('ImgList'); $i++) {
$htmlOut .= $imgDiv;
$imgDiv = '<br/>';
$htmlOut .= LISTLABEL('ImgList', $i);
}
return $htmlOut;
End Unverified %]
</div>
<input name="RadioFreeFormatQ_Radio" id="RadioFreeFormatQ_Radio" type="hidden" value="">
<style>
#ffImgContainer img {
cursor: pointer;
}
.ffSelected {
box-shadow: 0px 12px 22px 1px #333;
}
</style>
<script>
$(document).ready(function(){
var startVal = $('#RadioFreeFormatQ_Radio').val();
if (startVal != '') {
$('#ffImgContainer img:nth-of-type(' + startVal + ')').addClass('ffSelected');
}
$('#ffImgContainer img').each(function(){
$(this).click(function(){
var index = $('#ffImgContainer img').index($(this)) + 1;
$('#RadioFreeFormatQ_Radio').val(index);
$('#ffImgContainer img').removeClass('ffSelected');
$(this).addClass('ffSelected');
})
})
})
</script>
For the multiple response option, I created "CheckFreeFormatQ" and gave it hidden variables "Check1," "Check2," ... I used this similar code in the HTML section:
<div id="ffImgContainer">
[% Begin Unverified Perl
my $htmlOut = '';
my $imgDiv = '';
for (my $i = 1; $i <= LISTLENGTH('ImgList'); $i++) {
$htmlOut .= $imgDiv;
$imgDiv = '<br/>';
$htmlOut .= LISTLABEL('ImgList', $i);
}
return $htmlOut;
End Unverified %]
</div>
<input name="CheckFreeFormatQ_Check1" id="CheckFreeFormatQ_Check1" type="hidden" value="0">
<input name="CheckFreeFormatQ_Check2" id="CheckFreeFormatQ_Check2" type="hidden" value="0">
<input name="CheckFreeFormatQ_Check3" id="CheckFreeFormatQ_Check3" type="hidden" value="0">
<input name="CheckFreeFormatQ_Check4" id="CheckFreeFormatQ_Check4" type="hidden" value="0">
<input name="CheckFreeFormatQ_Check5" id="CheckFreeFormatQ_Check5" type="hidden" value="0">
<input name="CheckFreeFormatQ_Check6" id="CheckFreeFormatQ_Check6" type="hidden" value="0">
<input name="CheckFreeFormatQ_Check7" id="CheckFreeFormatQ_Check7" type="hidden" value="0">
<input name="CheckFreeFormatQ_Check8" id="CheckFreeFormatQ_Check8" type="hidden" value="0">
<input name="CheckFreeFormatQ_Check9" id="CheckFreeFormatQ_Check9" type="hidden" value="0">
<input name="CheckFreeFormatQ_Check10" id="CheckFreeFormatQ_Check10" type="hidden" value="0">
<style>
#ffImgContainer img {
cursor: pointer;
}
.ffSelected {
box-shadow: 0px 12px 22px 1px #333;
}
</style>
<script>
$(document).ready(function(){
for (var i = 1; i <= 10; i++) {
if ($('#CheckFreeFormatQ_Check' + i).val() == 1) {
$('#ffImgContainer img:nth-of-type(' + i + ')').addClass('ffSelected');
}
}
$('#ffImgContainer img').each(function(){
$(this).click(function(){
var index = $('#ffImgContainer img').index($(this)) + 1;
if ($('#CheckFreeFormatQ_Check' + index).val() == 1) {
$('#CheckFreeFormatQ_Check' + index).val(0);
$('#ffImgContainer img:nth-of-type(' + index + ')').removeClass('ffSelected');
}
else {
$('#CheckFreeFormatQ_Check' + index).val(1);
$('#ffImgContainer img:nth-of-type(' + index + ')').addClass('ffSelected');
}
})
})
})
</script>
In both codes, my question name should be replaced with yours. In addition, "ImgList" should be replaced with the name of your list.
Currently, I highlight selected items by giving them a box shadow. This can easily be modified by changing the ".ffSelected" part of the CSS.