do not allow to skip required field with whitespace

pull/267/head
Pete Matsyburka 2 years ago
parent ab57076b8f
commit 02a7b6ea55

@ -471,10 +471,14 @@ import i18n from './i18n'
const isEmpty = (obj) => { const isEmpty = (obj) => {
if (obj == null) return true if (obj == null) return true
if (Array.isArray(obj) || typeof obj === 'string') { if (Array.isArray(obj)) {
return obj.length === 0 return obj.length === 0
} }
if (typeof obj === 'string') {
return obj.trim().length === 0
}
if (typeof obj === 'object') { if (typeof obj === 'object') {
return Object.keys(obj).length === 0 return Object.keys(obj).length === 0
} }

@ -34,7 +34,7 @@
class="base-input !text-2xl w-full" class="base-input !text-2xl w-full"
:class="{ '!pr-11 -mr-10': !field.validation?.pattern }" :class="{ '!pr-11 -mr-10': !field.validation?.pattern }"
:required="field.required" :required="field.required"
:pattern="field.validation?.pattern" :pattern="field.validation?.pattern || (field.required ? '.*\\S+.*' : '')"
:placeholder="`${t('type_here_')}${field.required ? '' : ` (${t('optional')})`}`" :placeholder="`${t('type_here_')}${field.required ? '' : ` (${t('optional')})`}`"
type="text" type="text"
:name="`values[${field.uuid}]`" :name="`values[${field.uuid}]`"

Loading…
Cancel
Save