From af91916b5821ac29703b6353cdf1a972ab7fe408 Mon Sep 17 00:00:00 2001 From: ZDDC Date: Mon, 8 Jun 2026 17:24:27 -0500 Subject: [PATCH] fix(tables): required-field check only enforces fields that are columns MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The client-side required check was enforcing every field in the row schema's `required` list — including ones with no table column (e.g. the risk register's project/discipline/sequence tracking-number components, which are composed server-side / set via the add-row form, not inline-editable). That blocked saves naming fields the user can't fill in the grid ("Can't save — required: party, project, discipline, sequence"). Now requiredFields() intersects `required` with the visible columns, so the client only blocks on required fields the table can actually fill; non-column required fields are left to the server (it composes them or returns a 422). Co-Authored-By: Claude Opus 4.8 (1M context) --- tables/js/save.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/tables/js/save.js b/tables/js/save.js index 517a80b..1ea4fd1 100644 --- a/tables/js/save.js +++ b/tables/js/save.js @@ -132,10 +132,18 @@ // --- Required-field validation + inline row errors ---------------- - // Field names the row schema marks required (form.yaml schema.required). + // Required fields the table can actually enforce: the row schema's + // `required` list intersected with the visible COLUMNS. Required fields + // that aren't columns (e.g. the risk register's project/discipline/ + // sequence tracking-number components, composed server-side or set via the + // add-row form) are NOT inline-fillable, so the client must not block on + // them — the server validates those (and composes them) authoritatively. function requiredFields() { const ctx = app.context || {}; - return (ctx.rowSchema && Array.isArray(ctx.rowSchema.required)) ? ctx.rowSchema.required : []; + const req = (ctx.rowSchema && Array.isArray(ctx.rowSchema.required)) ? ctx.rowSchema.required : []; + const colFields = {}; + (ctx.columns || []).forEach(function (c) { if (c && c.field) colFields[c.field] = true; }); + return req.filter(function (f) { return colFields[f]; }); } // Human label for a field — the column title, else the field name.