1)
Set up your survey to use JavaScript.
2) Add the following script to the source of the array. Replace "QQ" with the array
question ID.
The script puts listeners on the text inputs and if a number less than 0 or greater than the max value for that column is detected the value is reverted to the last valid one.
<script type="text/javascript" charset="utf-8">
$(document).ready(function() {
hoursMinutes(QQ, 12, 60);
function hoursMinutes(qID, col1Max, col2Max) {
// Load existing answers into memory
var answers = new Object();
$('#question'+qID+' input:[type="text"]').each(function(i){
answers[$(this).attr('id')] = $(this).val();
});
// Assign some classes
$('#question'+qID+' table.question tbody tr').each(function(i){
$('input:[type="text"]', this).each(function(i){
$(this).addClass('column-'+(i+1));
});
});
// Listeners on the inputs
$('#question'+qID+' input:[type="text"]').change(function(){
if($(this).hasClass('column-1')) {
var maxNum = col1Max;
}
else {
var maxNum = col2Max;
}
if($(this).val() < 0 || $(this).val() > maxNum) { // Fail - revert to answer in memory
$(this).val(answers[$(this).attr('id')]);
}
else { // Pass - update answer in memory
answers[$(this).attr('id')] = $(this).val();
}
});
}
});
</script>