Browse Source

fix: revise form validations

pull/2415/head
Wing-Kam Wong 3 years ago
parent
commit
4cf303c75b
  1. 28
      packages/nc-gui/components/project/spreadsheet/views/FormView.vue

28
packages/nc-gui/components/project/spreadsheet/views/FormView.vue

@ -617,35 +617,21 @@ export default {
) { ) {
continue continue
} }
if ( if (!isVirtualCol(column) && (((column.rqd || column.notnull) && !column.cdf) || (column.pk && !(column.ai || column.cdf)) || column.required)) {
!column.virtual &&
(((column.rqd || column.notnull) && !column.cdf) ||
(column.pk && !(column.ai || column.default)) ||
this.localParams.fields[column.title].required)
) {
obj.localState[column.title] = { required } obj.localState[column.title] = { required }
} else if (column.bt) { } else if (column.uidt === UITypes.LinkToAnotherRecord && column.colOptions && column.colOptions.type === RelationTypes.BELONGS_TO) {
const col = this.meta.columns.find( const col = this.meta.columns.find(c => c.id === column.colOptions.fk_child_column_id)
c => c.column_name === column.bt.column_name
) if ((col && col.rqd && !col.cdf) || column.required) {
if ( if (col) { obj.virtual[column.title] = { required } }
(col.rqd && !col.default) ||
this.localParams.fields[column.title].required
) {
obj.localState[col.title] = { required }
} }
} else if ( } else if (isVirtualCol(column) && column.required) {
column.virtual &&
this.localParams.fields[column.title].required &&
(column.mm || column.hm)
) {
obj.virtual[column.title] = { obj.virtual[column.title] = {
minLength: minLength(1), minLength: minLength(1),
required required
} }
} }
} }
return obj return obj
}, },
computed: { computed: {

Loading…
Cancel
Save