Thanks to Dan Huston for this script. I have not tried it myself, but I trust Dan on this matter.
This script is going through all the fields in repeating sections and checks if value is provided.
In repeating section each label and field is suffixed with xxROWxxn, where n = 0,1,2,3…. etc.
Please see the idea behind this script and adjust to your needs.
var ErrorText = ""; function check_repeating_section(field_name, longfield_name) { var field; var validate = true; // loop to go from zero, until we no longer can find an field for (var i = 0; i != -1; i++) { field = document.getElementById(field_name + "xxROWxx" + i.toString() + "_txtInput"); //get field by ID if (field === null) //check if field exists { i=-1; return; // if no field, we exit the function } r = i + 1 if(field.value === "") { ErrorText += "Please enter a value for " + longfield_name + " in row " + r.toString() + ". \n"; validate = false; } } //end of for-loop return validate // if field there, we return it's value } if(!check_repeating_section("CourseName", "Course Name")) { alert(ErrorText); }