Set up your survey to use JavaScript and place the following script in the source of the array question.
Replace the following parameters in row 5:
- QQ = array question ID
- RR = row number to have maxlength applied
- NN = maxlength value
<script type="text/javascript" charset="utf-8">
$(document).ready(function(){
// Call the function with the question ID, row number and maxlength value
setLength(QQ, RR, NN);
// A function to set a maxlength attribute for text inputs in an array
function setLength(qID, rowNum, maxLength) {
var rowIndex = rowNum - 1;
$('#question'+qID+' table.question tbody:eq('+rowIndex+') input[type=text]').attr('maxlength', maxLength);
}
});
</script>
The call can be repeated for more rows. So, for example, the following calls would set a maxlength of 3 for row 2 inputs and a maxlength of 10 for row 4 inputs.
// Call the function with the question ID, row number and maxlength value
setLength(12345, 2, 3);
setLength(12345, 4, 10);