fix: Update min-length validation for the contact to support names with single characters (#10813)
This PR updates the contact form validation to allow a minimum length of one character for the first name. Fixes https://linear.app/chatwoot/issue/CW-3993/update-the-validation-on-contact-form-to-support-just-one-character ## Type of change - [x] Bug fix (non-breaking change which fixes an issue) ## How Has This Been Tested? https://github.com/user-attachments/assets/2b95af80-ee70-4f4b-8d0d-b01779db9d94 ## Checklist: - [x] My code follows the style guidelines of this project - [x] I have performed a self-review of my code - [ ] I have commented on my code, particularly in hard-to-understand areas - [ ] I have made corresponding changes to the documentation - [x] My changes generate no new warnings - [ ] I have added tests that prove my fix is effective or that my feature works - [x] New and existing unit tests pass locally with my changes - [ ] Any dependent changes have been merged and published in downstream modules
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import { computed, reactive, watch } from 'vue';
|
import { computed, reactive, watch } from 'vue';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { required, email, minLength } from '@vuelidate/validators';
|
import { required, email } from '@vuelidate/validators';
|
||||||
import { useVuelidate } from '@vuelidate/core';
|
import { useVuelidate } from '@vuelidate/core';
|
||||||
import { splitName } from '@chatwoot/utils';
|
import { splitName } from '@chatwoot/utils';
|
||||||
import countries from 'shared/constants/countries.js';
|
import countries from 'shared/constants/countries.js';
|
||||||
@@ -74,7 +74,7 @@ const defaultState = {
|
|||||||
const state = reactive({ ...defaultState });
|
const state = reactive({ ...defaultState });
|
||||||
|
|
||||||
const validationRules = {
|
const validationRules = {
|
||||||
firstName: { required, minLength: minLength(2) },
|
firstName: { required },
|
||||||
email: { email },
|
email: { email },
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -59,6 +59,7 @@ defineExpose({ dialogRef, contactsFormRef, onSuccess });
|
|||||||
t('CONTACTS_LAYOUT.HEADER.ACTIONS.CONTACT_CREATION.SAVE_CONTACT')
|
t('CONTACTS_LAYOUT.HEADER.ACTIONS.CONTACT_CREATION.SAVE_CONTACT')
|
||||||
"
|
"
|
||||||
color="blue"
|
color="blue"
|
||||||
|
:disabled="contactsFormRef?.isFormInvalid"
|
||||||
:is-loading="isCreatingContact"
|
:is-loading="isCreatingContact"
|
||||||
@click="handleDialogConfirm"
|
@click="handleDialogConfirm"
|
||||||
/>
|
/>
|
||||||
|
|||||||
Reference in New Issue
Block a user