I have a form in this fiddle that generates this error message on submit: "error" : "key missing: title." I can't figure out what it means.
On run, the form displays correctly in the output pane. On submit, the output pane goes black and that error message appears in black on black. One has to select it to read it.
JavaScript (in relevant part):
$(document).ready( function() {
document.addEventListener("submit", (e) => {
var formData = $( 'form' ).serializeArray();
var classes = buildClasses(formData);
}); // end arrow fn callback on event listener
}); // end doc.ready
function buildClasses(fd) {
...
} // end def fn buildClasses
My JavaScript syntax checker says all the code (not just what I've reproduced here) is syntactically correct.
In the snippet below, on submit, the console flashes some message for about a tenth of a second then disappears. This error message is left in the result pane: "The custom error module does not recognize this error."
Snippet
PS: Is there a way to hide the snippet code so that it doesn't show in the question by default?
$(document).ready(function() {
document.addEventListener("submit", (e) => {
e.preventDefault;
var formData = $('form').serializeArray();
console.log('log formData : ', formData);
var classes = buildClasses(formData);
// updateTable(classes);
console.log('log classes after build : ', classes);
}); // end arrow fn callback on event listener
}); // end doc.ready
function buildClasses(fd) {}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<head>
<title>jdfidde for buildClasses</title>
</head>
<form action="" method="post">
<div>
<label>First Name
<input type="text" name="fname" size="25">
</label>
</div>
<div>
<label>Last Name
<input type="text" name="lname" size="25">
</label>
</div>
<div>
<label>email address
<input type="email" name="email" size="25">
</label>
</div>
<div>
<label>08:30 Keynote Speaker
<select name="select 0830">
<option value="unsure" >unsure</option>
<option value="attend" >attend</option>
<option value="not attend">not attend</option>
</select>
</label>
<label>09:00 Classes
<select name="select 0900">
<option value="unsure">unsure</option>
<option value="A">room A</option>
<option value="B">room B</option>
</select>
</label>
<label>10:30 Classes
<select name="select 1030">
<option value="unsure">unsure</option>
<option value="A">room A</option>
<option value="B">room B</option>
</select>
</label>
</div>
<div>
<input type="submit" value="submit form">
</div>
</form>
