I have a form working in as much as it writes to the spreadsheet. The input fields have the status of required and the form calls the script on submit.
After searching I have discovered that the validation needs to happen before the submit but I am struggling to make it work. Any advice? The form code is here:
and I have tried a solution suggested here: Check required fields on Form
by adding the <div class="ss-item-required">
tags and including the code
function formcheck() {
var fields = $(".ss-item-required")
.find("select, textarea, input").serializeArray();
$.each(fields, function(i, field) {
if (!field.value)
alert(field.name + ' is required');
});
console.log(fields);
}
but all I got on the console was class undefined errors.