feedback: no question is required — an empty or partial form submits

Remove the required flag from all 13 questions, drop the submit-blocking
validation (no error is ever announced), and send only the questions that
were answered. The error nodes and their CSS stay in place but nothing sets
them. Empty submit now fires 1 request and shows the receipt (was 0).
This commit is contained in:
webmaster committed 2026-11-04 10:20:22 +00:00
1 parent 61fd457af0
commit 68a388cd78
1 file changed
+24 -44
+24 -44
View File
@@ -341,20 +341,22 @@
// ---- The feedback form ----------------------------------------------------------------
// The n8n form's questions, with the copy corrected. The identity block (name, email,
// anonymous tick) and the publish-consent question are gone — do not bring them back.
// None of these questions is compulsory: the form submits with any subset answered, or none.
// The error nodes (.err) and their CSS are kept, but nothing sets them any more.
var FIELDS = [
{ id: "finalized", label: "Did you finalize the signup?", type: "select", options: [["yes", "Yes"], ["no", "No"]], required: true },
{ id: "difficulty", label: "How hard was the signup?", type: "select", options: [["easy", "Easy"], ["ok", "OK"], ["hard", "Hard"]], required: true },
{ id: "signup_feedback", label: "What is your feedback on the signup?", type: "textarea", required: true },
{ id: "understood_scale", label: "Did you understand how we ask you to rate your skills? (the 15-point scale)", type: "select", options: [["yes", "Yes"], ["no", "No"]], required: true },
{ id: "scale_feedback", label: "What is your feedback on the 15-point skill scale?", type: "textarea", required: true },
{ id: "almost_stopped", label: "What almost stopped you from signing up?", type: "textarea", required: true, hint: "If nothing did, say so." },
{ id: "broke_or_confused", label: "Did anything break or confuse you?", type: "textarea", required: true },
{ id: "design_shows_work", label: "Do you think our profile design shows what you do well?", type: "select", options: [["yes", "Yes"], ["so-so", "So-so"], ["no", "No"]], required: true },
{ id: "design_feedback", label: "What can we improve about the profile design?", type: "textarea", required: true },
{ id: "will_stay", label: "Will you stay on the platform?", type: "select", options: [["yes", "Yes"], ["no", "No"]], required: true },
{ id: "improve_offer", label: "How can we improve what we offer you?", type: "textarea", required: true },
{ id: "recommend", label: "Would you recommend this platform to a freelance colleague?", type: "select", options: [["yes", "Yes, good idea"], ["maybe", "Maybe"], ["no", "Preferably not"]], required: true },
{ id: "expect_next", label: "What do you expect to happen next — and how soon?", type: "textarea", required: true }
{ id: "finalized", label: "Did you finalize the signup?", type: "select", options: [["yes", "Yes"], ["no", "No"]] },
{ id: "difficulty", label: "How hard was the signup?", type: "select", options: [["easy", "Easy"], ["ok", "OK"], ["hard", "Hard"]] },
{ id: "signup_feedback", label: "What is your feedback on the signup?", type: "textarea" },
{ id: "understood_scale", label: "Did you understand how we ask you to rate your skills? (the 15-point scale)", type: "select", options: [["yes", "Yes"], ["no", "No"]] },
{ id: "scale_feedback", label: "What is your feedback on the 15-point skill scale?", type: "textarea" },
{ id: "almost_stopped", label: "What almost stopped you from signing up?", type: "textarea", hint: "If nothing did, say so." },
{ id: "broke_or_confused", label: "Did anything break or confuse you?", type: "textarea" },
{ id: "design_shows_work", label: "Do you think our profile design shows what you do well?", type: "select", options: [["yes", "Yes"], ["so-so", "So-so"], ["no", "No"]] },
{ id: "design_feedback", label: "What can we improve about the profile design?", type: "textarea" },
{ id: "will_stay", label: "Will you stay on the platform?", type: "select", options: [["yes", "Yes"], ["no", "No"]] },
{ id: "improve_offer", label: "How can we improve what we offer you?", type: "textarea" },
{ id: "recommend", label: "Would you recommend this platform to a freelance colleague?", type: "select", options: [["yes", "Yes, good idea"], ["maybe", "Maybe"], ["no", "Preferably not"]] },
{ id: "expect_next", label: "What do you expect to happen next — and how soon?", type: "textarea" }
];
function fieldBlock(spec) {
@@ -423,10 +425,15 @@
form.addEventListener("submit", function (ev) {
ev.preventDefault();
var bad = false;
// Nothing here is compulsory, so there is nothing to validate and nothing to announce.
// The .err nodes and their CSS are kept in place in case a question is ever made
// compulsory again, but nothing here sets them: an empty form submits like any other.
// Build the body. Only the questions that were answered, and nothing else — no
// name, no email, no identifier, and no empty string for a question left blank.
var body = { form: "feedback" };
FIELDS.forEach(function (spec) {
var holder = form.querySelector('[data-field="' + spec.id + '"]');
var err = holder.querySelector(".err");
var v = "";
if (spec.type === "radio") {
var checked = form.querySelector('input[name="' + spec.id + '"]:checked');
@@ -435,34 +442,7 @@
var ctl = form.querySelector("#fb-" + spec.id);
v = ctl ? ctl.value.trim() : "";
}
if (spec.required && !v) {
holder.setAttribute("data-bad", "1");
err.textContent = "Please answer this before sending.";
err.hidden = false;
bad = true;
} else {
holder.removeAttribute("data-bad");
err.hidden = true;
}
});
if (bad) {
line.className = "status state-warn";
line.textContent = "Some answers are missing — see the notes above.";
var firstBad = form.querySelector('[data-bad="1"] input, [data-bad="1"] textarea, [data-bad="1"] select');
if (firstBad) firstBad.focus();
return;
}
// Build the body. The answers and nothing else — no name, no email, no identifier.
var body = { form: "feedback" };
FIELDS.forEach(function (spec) {
if (spec.type === "radio") {
var checked = form.querySelector('input[name="' + spec.id + '"]:checked');
body[spec.id] = checked ? checked.value : "";
} else {
var ctl = form.querySelector("#fb-" + spec.id);
body[spec.id] = ctl ? ctl.value.trim() : "";
}
if (v) body[spec.id] = v;
});
btn.disabled = true;