fix: better validation on Contact form
This commit is contained in:
parent
fdd4589e1e
commit
30a271249c
1 changed files with 43 additions and 30 deletions
|
@ -7,12 +7,20 @@
|
||||||
>
|
>
|
||||||
Ici vous pouvez préciser quelques manières de contacter votre association, aucun des champs indiqués n'est obligatoire.
|
Ici vous pouvez préciser quelques manières de contacter votre association, aucun des champs indiqués n'est obligatoire.
|
||||||
</v-alert>
|
</v-alert>
|
||||||
|
<v-alert
|
||||||
|
v-if="!formValid"
|
||||||
|
dense
|
||||||
|
type="error"
|
||||||
|
>
|
||||||
|
Attention ! Certains des champs renseignés sont invalides !
|
||||||
|
</v-alert>
|
||||||
</div>
|
</div>
|
||||||
<!-- <v-text-field
|
<!-- <v-text-field
|
||||||
prepend-icon="call"
|
prepend-icon="call"
|
||||||
label="Numéro de téléphone"
|
label="Numéro de téléphone"
|
||||||
outlined
|
outlined
|
||||||
v-model="$store.state.data.contacts.phone" /> -->
|
v-model="$store.state.data.contacts.phone" /> -->
|
||||||
|
<v-form v-model="formValid" ref="form">
|
||||||
<v-text-field
|
<v-text-field
|
||||||
prepend-icon="public"
|
prepend-icon="public"
|
||||||
label="Site web"
|
label="Site web"
|
||||||
|
@ -43,6 +51,7 @@
|
||||||
outlined
|
outlined
|
||||||
v-model="$store.state.data.contacts.instagram"
|
v-model="$store.state.data.contacts.instagram"
|
||||||
:rules="rules.instagram" />
|
:rules="rules.instagram" />
|
||||||
|
</v-form>
|
||||||
<AdditionalContacts />
|
<AdditionalContacts />
|
||||||
<!-- <v-card
|
<!-- <v-card
|
||||||
v-for="(contact, index) in $store.state.data.contacts.peoples"
|
v-for="(contact, index) in $store.state.data.contacts.peoples"
|
||||||
|
@ -92,7 +101,11 @@ export default {
|
||||||
components: {
|
components: {
|
||||||
AdditionalContacts
|
AdditionalContacts
|
||||||
},
|
},
|
||||||
|
mounted () {
|
||||||
|
this.$refs.form.validate()
|
||||||
|
},
|
||||||
data: () => ({
|
data: () => ({
|
||||||
|
formValid: false,
|
||||||
rules: {
|
rules: {
|
||||||
website: [
|
website: [
|
||||||
v => v === '' || /^(?:http(s)?:\/\/)?[\w.-]+(?:\.[\w.-]+)+[\w\-._~:/?#[\]@!$&'()*+,;=.]+$/gm.test(v) || "L'adresse web doit être valide"
|
v => v === '' || /^(?:http(s)?:\/\/)?[\w.-]+(?:\.[\w.-]+)+[\w\-._~:/?#[\]@!$&'()*+,;=.]+$/gm.test(v) || "L'adresse web doit être valide"
|
||||||
|
|
Loading…
Reference in a new issue