Browse Source

Fix issue saving a doc with a multi-options datatype that was not defined

master
Andrew Kingston 5 years ago
parent
commit
dd73ed3e1a
  1. 6
      packages/server/src/api/controllers/row/utils.js

6
packages/server/src/api/controllers/row/utils.js

@ -68,7 +68,11 @@ exports.validate = async ({ appId, tableId, row, table }) => {
let res
// Validate.js doesn't seem to handle array
if (table.schema[fieldName].type === FieldTypes.ARRAY) {
if (
table.schema[fieldName].type === FieldTypes.ARRAY &&
row[fieldName] &&
row[fieldName].length
) {
row[fieldName].map(val => {
if (!constraints.inclusion.includes(val)) {
errors[fieldName] = "Field not in list"

Loading…
Cancel
Save