Required Input Validation

Team,

We required users can enter only 10 digits in mobile Number column. Pl guide how can achieve this.

Hi Kundan,

To restrict a phone number field to 10 digits only, you can use Validations.

After dropping the Phone control, you can go to the validations tab and apply the validation.

This is how the validations will look.
Phone%20validations

The First check adds minimum number to be 999999999 which is 9 digits long
The Second check adds the maximum number to be 9999999999 which is 10 digits long.

We will try to add length validation in the phone number field soon , but till then this should work.

Regards,
Mohit

Hi Mohit,

Thanks for your guidance how to achieve validation, Although I think we have to modify some parameters to fully achieve this.

Hi Kundan,

The correct solution would be to use regular expression.

Phone%20validations

You can use the regex ^[6-9]\d{9}$ as shown above.

This will validate:

  1. The value should start with a number from 6 - 9.
  2. The Length should exactly be 10 digits.

Further Reading:

For Indian pin code validation, You can use regex too.
It would look something like

Pin-code%20Validation

This will validate:

  1. Value can be only six digits.
  2. First digit of the pin code must be from 1 to 9.
  3. Next five digits of the pin code may range from 0 to 9.

Hope this helps.

Regards,
Mohit.

1 Like

Appreciable Efforts. Great, Thank you for help.

Hi Mohit,

I tried the same but my validation disappear once we click anywhere after save.

HI Kundan,

We are doing a small fix on Phone control due to which you might face issues while applying regular expressions to it. This will be fixed very soon.

I would recommend you continue creating the app and we’ll let you know once you can use regular expression in this control.

If you need to use the field right now, you can use a text control where this regular expression will work.

Regards,
Mohit.

Hi Kundan,
You can now use the regular expression for the said use case.

Regards,
Mohit Agarwal.

Dear Mohit,

On the Same FOrmat to Validate PAN Number, I am using regex ^[A-Z]{5}[0-9]{4}[A-Z]{1}$ and ^[A-Z]{5}[0-9]{4}[A-Z]$

But the same is not working, please guide or give me any tutorial to use regex function.

Hi Kundan,

To make PAN card work, you can use the Regex:

^[a-zA-Z]{5}[0-9]{4}[a-zA-Z]{1}$

Here we check for lower and uppercase letters both, this ensures more cover and works fine.

Regards,
Mohit.