Question T10187
Visible to All Users

While email validation works fine telephone validation does not

created 3 years ago

I have a survey question, "please enter your email address". For the answer, I have set the input type to Email. So when I enter an invalid email address and hit the submit button, an error is displayed. I have attached a picture here with. This is working fine.

I have another survey question, "please enter your phone number". For this field, I have set the input type to "tel". So, I was expecting that this will perform some sort of phone number validation. However, even if I enter text characters, it still takes it. I've attached a picture here with.

How come email validation works fine but telephone validation does not?

Answers approved by surveyjs Support

created 3 years ago

Hello,

You need to use the "inputmask" custom widget. Here is the working example - https://surveyjs.io/Examples/Library?id=custom-widget-inputmask&platform=jQuery&theme=defaultV2

Thanks, Serge
SurveyJS Team

    Comments (2)

      Thanks for your response. It helped!

      We went ahead, implemented the input mask as you suggested and we have got this to work. However, we ran into another issue which we are unable to solve.

      This is with regards to US telephone numbers. These telephone numbers are 10 digit long. The mask does not let the entry of the 11th digit which is great. However, if I only type 8 digits and hit submit, an error is not flagged.

      We looked into the section called Validation and we have set up appropriate rules as well. However, we are not able to get this to work. What are we missing? Please see the attached pictures. The reason the validation is set to 14 and not 10 is because the input mask that we have set up contains parenthesis and spaces.

      What are we missing here?

        Hello,

        You posted screenshots of SurveyJS Creator from your application. This is a commercially licensed product. But I've not found any license linked to your email or domain. Could write us from the email linked to your license?

        Thanks, Serge
        SurveyJS Team