9
Views
3
Comments
Solved
Phone number required to start with 00316 (reactive web app)

Hi,

I have developed my first reactive web app and am trying to fix the last details. For the communication with a different application via a REST API, I need the phone number to start with 00316. However, users fill in their own phone number which could cause them to fill it in starting with 06 or +316 (It'll be only Dutch phone numbers). I want to add some validation to the input of the phone number to ensure only inputs starting with 00316 are accepted. I have used the Custom Input Mask from Forge before, but this doesn't work for reactive apps. 

Does anyone know how to properly mask/validate the phone number input?

Kind regards,

Shanna

Rank: #2139
Solution

Hi Shanna,


Is it maybe an option do to something like this?:

If it's always a dutch number and there are no other options, why even ask the user to fill in the number? If you just disable the first input box from input and take the input of the second box and put them together you have your number aswell. If this is not an option you probably have to look into regex. 

https://regexlib.com/Search.aspx?k=phone%20number&AspxAutoDetectCookieSupport=1

This might be a good site to look at.

Rank: #54
Solution

Hi Shanna,


There are also Input Masks forge components for Reactive, like the Input Masks Library forge component.

If you want to build the validations yourself, you can use Regular Expressions to validate that using the pattern ^(00316|06|\+316) - this means it will validate that the string starts with 00316, 06 or +316.


You can take a look at the component Regex How To forge component to learn how to use client side which makes more sense as you are building a Reactive application and doing UI validation.


Kind Regards,
João

Rank: #2139
Solution

Hi Shanna,


Is it maybe an option do to something like this?:

If it's always a dutch number and there are no other options, why even ask the user to fill in the number? If you just disable the first input box from input and take the input of the second box and put them together you have your number aswell. If this is not an option you probably have to look into regex. 

https://regexlib.com/Search.aspx?k=phone%20number&AspxAutoDetectCookieSupport=1

This might be a good site to look at.

Thank you both! I am going to do some UAT with setting the 00316 as fixed and then combining the input.

Will definitely look into Regex as well though.