paul-thebaud / v-phone-input

International and accessible phone input for Vuetify 3 and Vue 3.
https://paul-thebaud.github.io/v-phone-input/
MIT License
65 stars 6 forks source link

question: accepting emergency numbers(3-4 digits) / trying to overwrite all the rules(using rules prop) #31

Closed Techbinator closed 7 months ago

Techbinator commented 7 months ago

Description

I would to modify the validation in order to allow emergency numbers(3-4 digits) like:

Police: 117 Fire service: 118 Medical service: 144

I tried the rules prop but that seems to add extra validation on top of the one that is already provided.

Is there an workaround that would allow me to overwrite all the built in validation rules or a prop that would allow this type of numbers?

Expected Behavior

When passing the rules prop it should overwrite all the other validations

Actual Behavior

When rules prop is passed it simply adds extra rules on top of the built in ones

Steps to Reproduce the Problem

  1. Try to enter a emergency number ex 117
  2. Throws an error even if rules prop is overwritten

Specifications

Latest version

paul-thebaud commented 7 months ago

Hello @Techbinator, You can disable built-in validation by passing a null invalidMessage property as follow:

<v-phone-input
  :invalid-message="null"
/>

However, using VPhoneInput for your current requirement may not be a good idea, as it will try to format the number to E164 according to the given country (e.g. +3318 with 18 input for France).

paul-thebaud commented 7 months ago

@Techbinator I will add a note on the default validation by-passing on README, feel free to reopen this issue if it is not resolved.

Techbinator commented 7 months ago

awesome thanks a lot! Works like a charm