Check out the LimeSurvey source code on GitHub!

Formating Phone Number (555) 555-5555

More
3 years 6 months ago #97472 by PRO_HENAU
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
3 years 6 months ago - 3 years 6 months ago #97479 by actxcellence
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: 3 years 6 months ago by actxcellence.

Please Log in to join the conversation.

More
3 years 6 months ago #97502 by tpartner
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
3 years 6 months ago #97515 by DenisChenu
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).

Please Log in to join the conversation.

Imprint                   Privacy policy         General Terms & Conditions         Revocation information and revocation form