Formating Phone Number (555) 555-5555

More
4 years 1 month ago #97472 by PRO_HENAU
PRO_HENAU created the topic: Formating Phone Number (555) 555-5555
I'd like to have the person taking the survey enter their phone number in the follwing format:

(555) 555-5555


I am placing the following code:
((?:\(\d{3}\)\s*\d{3}-\d{4})

Here is the question information:

Code: Employee_Phone : (Mandatory question)
Question: What is your phone number?
Help: Please provide the best number to contact you.
Validation: ((?:\(\d{3}\)\s*\d{3}-\d{4})
Type: Numerical input
Mandatory: Yes

The results are a red box that does not validate.

I'm brand new to all this and have been trying to read and follow directions, but I can't seem to figure this out.

Thanks.

Please Log in to join the conversation.

More
4 years 1 month ago - 4 years 1 month ago #97479 by actxcellence
actxcellence replied the topic: Formating Phone Number (555) 555-5555
My pragmatic solution would be:
Do not validate this information.
think twice before you bother your users with double constraint input, if not essential for the project. It could be the moment when a user decides to discontinue the survey.

someone might want to be precise and helpful and enters: (555) 555-5555 till 2pm, then dial 555-5545
why punish them?

I can't help with a technical solution

may be this helps:
www.freeformatter.com/regex-tester.html

Schon die Bedienungsanleitung von LimeSurvey angeschaut?
Bedienungsanleitung (DE) | Tricks, um mehr Antworten auf Fragen im Forum zu erhalten
Last Edit: 4 years 1 month ago by actxcellence.

Please Log in to join the conversation.

More
4 years 1 month ago #97502 by tpartner
tpartner replied the topic: Formating Phone Number (555) 555-5555
You could put a mask on the question - digitalbush.com/projects/masked-input-plugin/

Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.

Please Log in to join the conversation.

More
4 years 1 month ago #97515 by DenisChenu
DenisChenu replied the topic: Formating Phone Number (555) 555-5555
Hello,

You CAN NOT validate such mask with "numeric question" type.

It's not numeric but text: 1st : use text question type and test again.

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand (or search sondages pro).
An error happen ? Before make a new topic : remind the Debug mode .

Please Log in to join the conversation.

Did you already participate in our customer survey?

Don't miss your chance for great prices.

Please click here to participate:

Start now

Start now!

Just create your account and start using Limesurvey today.

Register now