mirror of
https://github.com/ThisIsBenny/wishlist-app.git
synced 2025-04-19 23:37:41 +00:00
mark mandatory fields
Signed-off-by: Benny Samir Hierl <bennysamir@posteo.de>
This commit is contained in:
parent
a87aa71ec5
commit
9f63089261
5 changed files with 41 additions and 19 deletions
|
@ -4,6 +4,7 @@
|
||||||
<InputText
|
<InputText
|
||||||
name="title"
|
name="title"
|
||||||
type="text"
|
type="text"
|
||||||
|
required
|
||||||
:value="wishlist?.title"
|
:value="wishlist?.title"
|
||||||
:label="t('components.form-wishlist.title.label')"
|
:label="t('components.form-wishlist.title.label')"
|
||||||
/>
|
/>
|
||||||
|
@ -22,16 +23,19 @@
|
||||||
<InputText
|
<InputText
|
||||||
name="imageSrc"
|
name="imageSrc"
|
||||||
type="text"
|
type="text"
|
||||||
|
required
|
||||||
:value="wishlist?.imageSrc"
|
:value="wishlist?.imageSrc"
|
||||||
:label="t('components.form-wishlist.image-src.label')"
|
:label="t('components.form-wishlist.image-src.label')"
|
||||||
/>
|
/>
|
||||||
<InputFile
|
<InputFile
|
||||||
name="imageFile"
|
name="imageFile"
|
||||||
|
required
|
||||||
:label="t('components.form-wishlist.image-file.label')"
|
:label="t('components.form-wishlist.image-file.label')"
|
||||||
/>
|
/>
|
||||||
<InputText
|
<InputText
|
||||||
name="slugUrlText"
|
name="slugUrlText"
|
||||||
type="text"
|
type="text"
|
||||||
|
required
|
||||||
:value="wishlist?.slugUrlText"
|
:value="wishlist?.slugUrlText"
|
||||||
:label="t('components.form-wishlist.slug-text.label')"
|
:label="t('components.form-wishlist.slug-text.label')"
|
||||||
/>
|
/>
|
||||||
|
|
|
@ -22,12 +22,14 @@
|
||||||
<InputText
|
<InputText
|
||||||
name="title"
|
name="title"
|
||||||
type="text"
|
type="text"
|
||||||
|
required
|
||||||
:value="item.title"
|
:value="item.title"
|
||||||
:label="t('components.form-wishlist-item.title.label')"
|
:label="t('components.form-wishlist-item.title.label')"
|
||||||
/>
|
/>
|
||||||
<InputTextArea
|
<InputTextArea
|
||||||
name="description"
|
name="description"
|
||||||
type="text"
|
type="text"
|
||||||
|
required
|
||||||
:value="item.description"
|
:value="item.description"
|
||||||
height-class="h-20"
|
height-class="h-20"
|
||||||
:label="t('components.form-wishlist-item.description.label')"
|
:label="t('components.form-wishlist-item.description.label')"
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="relative mb-8">
|
<div class="relative mb-8">
|
||||||
<label class="mb-1 block w-full" :for="name">{{ label }}</label>
|
<label class="mb-1 block w-full" :for="name"
|
||||||
|
>{{ label }}<span v-if="required" class="text-red-500">*</span></label
|
||||||
|
>
|
||||||
<div
|
<div
|
||||||
class="flex h-24 w-full flex-row items-center space-x-10 rounded-md border-2 border-solid border-stone-300 bg-transparent px-2 outline-none dark:border-stone-700"
|
class="flex h-24 w-full flex-row items-center space-x-10 rounded-md border-2 border-solid border-stone-300 bg-transparent px-2 outline-none dark:border-stone-700"
|
||||||
:class="{
|
:class="{
|
||||||
|
@ -70,6 +72,10 @@ const props = defineProps({
|
||||||
type: String,
|
type: String,
|
||||||
required: true,
|
required: true,
|
||||||
},
|
},
|
||||||
|
required: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false,
|
||||||
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
const { value, errorMessage, setErrors } = useField(props.name, undefined, {})
|
const { value, errorMessage, setErrors } = useField(props.name, undefined, {})
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="relative mb-8">
|
<div class="relative mb-8">
|
||||||
<label class="mb-1 block w-full" :for="name">{{ label }}</label>
|
<label class="mb-1 block w-full" :for="name"
|
||||||
|
>{{ label }}<span v-if="required" class="text-red-500">*</span></label
|
||||||
|
>
|
||||||
<input
|
<input
|
||||||
class="h-12 w-full rounded-md border-2 border-solid border-stone-300 bg-transparent px-2 outline-none dark:border-stone-700"
|
class="h-12 w-full rounded-md border-2 border-solid border-stone-300 bg-transparent px-2 outline-none dark:border-stone-700"
|
||||||
:class="{ 'border-rose-500': !!errorMessage }"
|
:class="{ 'border-rose-500': !!errorMessage }"
|
||||||
|
@ -44,13 +46,16 @@ const props = defineProps({
|
||||||
type: String,
|
type: String,
|
||||||
default: '',
|
default: '',
|
||||||
},
|
},
|
||||||
|
required: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false,
|
||||||
|
},
|
||||||
})
|
})
|
||||||
const {
|
const { value: inputValue, errorMessage, handleBlur, handleChange } = useField(
|
||||||
value: inputValue,
|
props.name,
|
||||||
errorMessage,
|
undefined,
|
||||||
handleBlur,
|
{
|
||||||
handleChange,
|
|
||||||
} = useField(props.name, undefined, {
|
|
||||||
initialValue: props.value,
|
initialValue: props.value,
|
||||||
})
|
}
|
||||||
|
)
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="relative mb-8">
|
<div class="relative mb-8">
|
||||||
<label class="mb-1 block w-full" :for="name">{{ label }}</label>
|
<label class="mb-1 block w-full" :for="name"
|
||||||
|
>{{ label }}<span v-if="required" class="text-red-500">*</span></label
|
||||||
|
>
|
||||||
<textarea
|
<textarea
|
||||||
class="w-full rounded-md border-2 border-solid border-stone-300 bg-transparent px-2 outline-none dark:border-stone-700"
|
class="w-full rounded-md border-2 border-solid border-stone-300 bg-transparent px-2 outline-none dark:border-stone-700"
|
||||||
:class="[heightClass, !!errorMessage ? 'border-rose-500' : '']"
|
:class="[heightClass, !!errorMessage ? 'border-rose-500' : '']"
|
||||||
|
@ -48,13 +50,16 @@ const props = defineProps({
|
||||||
type: String,
|
type: String,
|
||||||
default: '',
|
default: '',
|
||||||
},
|
},
|
||||||
|
required: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false,
|
||||||
|
},
|
||||||
})
|
})
|
||||||
const {
|
const { value: inputValue, errorMessage, handleBlur, handleChange } = useField(
|
||||||
value: inputValue,
|
props.name,
|
||||||
errorMessage,
|
undefined,
|
||||||
handleBlur,
|
{
|
||||||
handleChange,
|
|
||||||
} = useField(props.name, undefined, {
|
|
||||||
initialValue: props.value,
|
initialValue: props.value,
|
||||||
})
|
}
|
||||||
|
)
|
||||||
</script>
|
</script>
|
||||||
|
|
Loading…
Add table
Reference in a new issue