Skip to content

Commit 4a46dac

Browse files
committed
Fix form input errors check
1 parent 0b3fe43 commit 4a46dac

8 files changed

+9
-9
lines changed

client/components/forms/FlatSelectInput.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
<Loader v-if="loading" key="loader" class="h-6 w-6 text-nt-blue mx-auto" />
1010
<div v-for="(option, index) in options" v-else :key="option[optionKey]" role="button"
11-
:class="[theme.default.input,'cursor-pointer hover:bg-gray-50 dark:hover:bg-gray-900 flex',{ 'mb-2': index !== options.length,'!ring-red-500 !ring-2': hasValidation && form.errors.has(name), '!cursor-not-allowed !bg-gray-200':disabled }]"
11+
:class="[theme.default.input,'cursor-pointer hover:bg-gray-50 dark:hover:bg-gray-900 flex',{ 'mb-2': index !== options.length,'!ring-red-500 !ring-2': hasError, '!cursor-not-allowed !bg-gray-200':disabled }]"
1212
@click="onSelect(option[optionKey])"
1313
>
1414
<p class="flex-grow">

client/components/forms/ImageInput.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
<span class="inline-block w-full rounded-md shadow-sm">
1010
<button type="button" aria-haspopup="listbox" aria-expanded="true" aria-labelledby="listbox-label"
11-
class="cursor-pointer relative w-full" :class="[theme.default.input,{'ring-red-500 ring-2': hasValidation && form.errors.has(name)}]"
11+
class="cursor-pointer relative w-full" :class="[theme.default.input,{'ring-red-500 ring-2': hasError}]"
1212
:style="inputStyle" @click.prevent="showUploadModal=true"
1313
>
1414
<div v-if="currentUrl==null" class="h-6 text-gray-600 dark:text-gray-400">

client/components/forms/PhoneInput.vue

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<v-select v-model="selectedCountryCode" class="w-[130px]" dropdown-class="w-[300px]" input-class="rounded-r-none"
1111
:data="countries"
1212
:disabled="(disabled || countries.length===1)?true:null" :searchable="true" :search-keys="['name']" :option-key="'code'" :color="color"
13-
:has-error="hasValidation && form.errors.has(name)"
13+
:has-error="hasError"
1414
:placeholder="'Select a country'" :uppercase-labels="true" :theme="theme" @update:model-value="onChangeCountryCode"
1515
>
1616
<template #option="props">
@@ -28,7 +28,7 @@
2828
</template>
2929
</v-select>
3030
<input v-model="inputVal" type="text" class="inline-flex-grow !border-l-0 !rounded-l-none" :disabled="disabled?true:null"
31-
:class="[theme.default.input, { '!ring-red-500 !ring-2': hasValidation && form.errors.has(name), '!cursor-not-allowed !bg-gray-200': disabled }]"
31+
:class="[theme.default.input, { '!ring-red-500 !ring-2': hasError, '!cursor-not-allowed !bg-gray-200': disabled }]"
3232
:placeholder="placeholder" :style="inputStyle" @input="onInput"
3333
>
3434
</div>

client/components/forms/RichTextAreaInput.client.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
</template>
88

99
<vue-editor :id="id?id:name" ref="editor" v-model="compVal" :disabled="disabled?true:null"
10-
:placeholder="placeholder" :class="[{ '!ring-red-500 !ring-2': hasValidation && form.errors.has(name), '!cursor-not-allowed !bg-gray-200':disabled }, theme.RichTextAreaInput.input]"
10+
:placeholder="placeholder" :class="[{ '!ring-red-500 !ring-2': hasError, '!cursor-not-allowed !bg-gray-200':disabled }, theme.RichTextAreaInput.input]"
1111
:editor-toolbar="editorToolbar" class="rich-editor resize-y"
1212
:style="inputStyle"
1313
/>

client/components/forms/SelectInput.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
:placeholder="placeholder"
1919
:uppercase-labels="uppercaseLabels"
2020
:theme="theme"
21-
:has-error="hasValidation && form.errors.has(name)"
21+
:has-error="hasError"
2222
:allow-creation="allowCreation"
2323
:disabled="disabled?true:null"
2424
:help="help"

client/components/forms/SignatureInput.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
</template>
88

99
<VueSignaturePad ref="signaturePad"
10-
:class="[theme.default.input,{ '!ring-red-500 !ring-2': hasValidation && form.errors.has(name), '!cursor-not-allowed !bg-gray-200':disabled }]"
10+
:class="[theme.default.input,{ '!ring-red-500 !ring-2': hasError, '!cursor-not-allowed !bg-gray-200':disabled }]"
1111
height="150px"
1212
:name="name"
1313
:options="{ onEnd }"

client/components/forms/TextAreaInput.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
</template>
88

99
<textarea :id="id?id:name" v-model="compVal" :disabled="disabled?true:null"
10-
:class="[theme.default.input,{ '!ring-red-500 !ring-2': hasValidation && form.errors.has(name), '!cursor-not-allowed !bg-gray-200':disabled }]"
10+
:class="[theme.default.input,{ '!ring-red-500 !ring-2': hasError, '!cursor-not-allowed !bg-gray-200':disabled }]"
1111
class="resize-y"
1212
:name="name" :style="inputStyle"
1313
:placeholder="placeholder"

client/components/forms/useFormInput.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ export function useFormInput (props, context, formPrefixKey = null) {
3333
})
3434

3535
const hasError = computed(() => {
36-
return hasValidation && props.form?.errors?.has(props.name)
36+
return hasValidation.value && props.form?.errors?.has(props.name)
3737
})
3838

3939
const compVal = computed({

0 commit comments

Comments
 (0)