Welcome, Guest
Username: Password: Remember me

TOPIC: Entering phone # contact information

Entering phone # contact information 6 months 2 weeks ago #108341

  • jpw
  • jpw's Avatar
  • OFFLINE
  • Fresh Lemon
  • Posts: 15
  • Karma: 0
I want to have respondents enter their phone # contact information (US) with fields for the area code (xxx), prefix xxx, a "-" character, suffix xxxx and ext. (up to 8 characters). Is there a way to have separate validation expressions for each field. In other words, can I have a before and after () for the area code but only allow the #s 2-9 as the leading digit for the area code; only allow 3 digits for the prefix with the leading digit from 2-9; only allow 4 digits for the suffix.
The administrator has disabled public write access.

Entering phone # contact information 6 months 2 weeks ago #108342

  • Ben_V
  • Ben_V's Avatar
  • OFFLINE
  • Platinum Lime
  • Posts: 1151
  • Thank you received: 274
  • Karma: 79
Do you mean that you need other validation than regex available here ?
Benoît

goo.gl/Bw5iM => Recherche GG dans le forum français (remplacer "exemple" dans la barre de recherche)
goo.gl/WX8PH => GG search for english forum (Replace "example" in the search bar)
goo.gl/IxiGu => Búsqueda en el foro en español (Cambiar "ejemplo" en la barra de...
Last Edit: 6 months 2 weeks ago by Ben_V.
The administrator has disabled public write access.

Entering phone # contact information 6 months 2 weeks ago #108343

  • jpw
  • jpw's Avatar
  • OFFLINE
  • Fresh Lemon
  • Posts: 15
  • Karma: 0
I'm new to LimeSurvey and JavaSript, trying to "learn on the fly". I'm trying to create an array (texts or numbers) question with home/cell/work/other on the y-scale and area code, prefix, suffix, and ext on the x-scale. I wanted to have separate validation expressions for each of the area code, and prefix fields as well as only allow integers for all fields.

I wasn't sure if this was just too complicated for me to attempt and I should just enter the full # as one field with a separate field for the ext. In that case, I wasn't sure how to include the phone # validation expression for just the phone # fields and not the ext. fields.
The administrator has disabled public write access.

Entering phone # contact information 6 months 2 weeks ago #108344

  • Ben_V
  • Ben_V's Avatar
  • OFFLINE
  • Platinum Lime
  • Posts: 1151
  • Thank you received: 274
  • Karma: 79
"Validation can be applied to individual cells within an array, such as this example where regular expression validations ensure that each entry is a properly formatted US phone number including area code. "
Found here

On the other hand, you can use 4 (home/cell/work/other) separate (text) questions with one of the regular expression provided above. It's easier and much better for small devices users ;)
Benoît

goo.gl/Bw5iM => Recherche GG dans le forum français (remplacer "exemple" dans la barre de recherche)
goo.gl/WX8PH => GG search for english forum (Replace "example" in the search bar)
goo.gl/IxiGu => Búsqueda en el foro en español (Cambiar "ejemplo" en la barra de...
Last Edit: 6 months 2 weeks ago by Ben_V.
The administrator has disabled public write access.

Entering phone # contact information 6 months 2 weeks ago #108347

  • jpw
  • jpw's Avatar
  • OFFLINE
  • Fresh Lemon
  • Posts: 15
  • Karma: 0
Thanks for your help! I'm still a little confused on how to enter the validation codes if I use separate text questions for home/cell/etc. If for example the home # question is an array (number or texts)question type and I want different validation expressions for the area code, prefix, and suffix fields; how do I separate the expressions for each filed? Would it be in the subquestion validation expression box and if so what syntax is used to ensure each expression checks the correct field.
The administrator has disabled public write access.

Entering phone # contact information 6 months 2 weeks ago #108363

  • Ben_V
  • Ben_V's Avatar
  • OFFLINE
  • Platinum Lime
  • Posts: 1151
  • Thank you received: 274
  • Karma: 79
I can't provide you the requiered expressions because I know very few things on how to set regex :(

Maybe you can have a look inside the complete regex for us phones, and try to retrieve some components...
For example, I think that the following expression, can validate a number from 200 to 999 (not tested):
/^(?:\([2-9]\d{2}\)\ ?|[2-9]\d{2})$/

Try it in a "subquestion validation expression box" :)
Benoît

goo.gl/Bw5iM => Recherche GG dans le forum français (remplacer "exemple" dans la barre de recherche)
goo.gl/WX8PH => GG search for english forum (Replace "example" in the search bar)
goo.gl/IxiGu => Búsqueda en el foro en español (Cambiar "ejemplo" en la barra de...
The administrator has disabled public write access.
Moderators: ITEd
Time to create page: 0.152 seconds
Donation Image