Add empty option

This commit is contained in:
philipp lang 2024-04-18 01:01:25 +02:00
parent af70e8654d
commit 9e30de968e
1 changed files with 3 additions and 3 deletions

View File

@ -9,7 +9,7 @@
>
<option :value="null">-- kein --</option>
<option v-for="(option, index) in options" :key="index" :value="option.id" v-text="option.name"></option>
<option v-if="field.empty_option" :value="-1" v-text="field.empty_option_value"></option>
<option v-if="field.has_empty_option" :value="-1" v-text="field.empty_option_value"></option>
</select>
<field-label :name="field.name" :required="field.required"></field-label>
</label>
@ -28,9 +28,9 @@ const props = defineProps({
field: {
required: true,
validator: (value) =>
hasKeys(value, [...globalFieldRules(), 'required', 'parent_field', 'parent_group', 'empty_option', 'empty_option_value']) &&
hasKeys(value, [...globalFieldRules(), 'required', 'parent_field', 'parent_group', 'has_empty_option', 'empty_option_value']) &&
typeof value.required === 'boolean' &&
typeof value.empty_option === 'boolean' &&
typeof value.has_empty_option === 'boolean' &&
typeof value.empty_option_value === 'string' &&
typeof value.key === 'string' &&
value.key.length > 0 &&